1

I'm trying to start working with GitLab for the first time. I created a new repo locally and tried to push that to GitLab. What I get is:

! [remote rejected] development -> development (pre-receive hook declined)

I know that by default master/main branch is protected so I (with a developer role) can't push there. That's why I from the even beginning created the developer branch. I even do not have the main branch locally at all, here is git branch output:

* development

So I'm definitely not trying to push into the main. But I still get this error. Could you please provide any ideas on how I should handle that?

Phelizer
  • 309
  • 2
  • 17
  • What command did you use to push to your repo? Also, this Question might help: https://stackoverflow.com/questions/7986139/git-error-when-trying-to-push-pre-receive-hook-declined – MauriceNino Jun 16 '21 at 07:40
  • @MauriceNino git push --set-upstream origin development – Phelizer Jun 16 '21 at 08:04
  • Hm weird, dont know too much about GitLab to be honest, but you could always just `git clone` the repo, and then make your changes (so just switch branch, copy the files and then push) – MauriceNino Jun 16 '21 at 11:13
  • "pre-receive hook declined" means they (GitLab) told you "no". Ideally, *before* they tell you "no, I won't do that", they should tell you *why* they won't do that. But if they won't tell you why, you'll have to ask them (GitLab) more directly / in-person, and see if you can get an answer. – torek Jun 16 '21 at 16:33

2 Answers2

2

Actually, the thing was in permissions. As I understand - if your role is developer and repo is empty (that means no main/master branch), than yau have no ability to up in it an initial commit as it means that you also push main/master there. So if you face this problem - ask somebody who maintain repo to increase your permissions temporarily for the time of first push

Phelizer
  • 309
  • 2
  • 17
0

Maybe the remote development branch has commits that you don't have, which would make the push a non fast-forward one.

Or, in this answer, you are pushing commits created with an email not yet verified.
That would be part of GitLab push rules, like this other one:

Restrict commits to existing GitLab users (checked against their emails).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The repo is empty, there are no commits. And I checked the status of my e-mail, it is verified. So, I guess, the problem is in something else – Phelizer Jun 16 '21 at 09:21
  • @Phelizer Is it gitlab.com? Are there any chance one of the push rules mentioned in https://docs.gitlab.com/ee/push_rules/push_rules.html is active? – VonC Jun 16 '21 at 09:27