I have run gitlabhq rails server on virtual machine, following 1-6 steps from this tutorial https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md and starts rails server executing command sudo -u git -H bundle exec rails s -e production
. After that I created user, using admin tools and created new project under this user. Then I'm trying to push the existing project to this repo as always. But in the last step, git push origin master
fails with the error
[remote rejected] master -> master (pre-receive hook declined)
Additional info:
1) I haven't activated user (project owner) via email activation link, because I haven't configured post service on server-side and I didn't find instructions how to do that in this manual.
2) Gitlab server generates tips how to push project to repo and there is not repositories/
in path. I mean it generates git@mygitlabhost:user/repo.git
instead of git@mygitlabhost:repositories/user/repo.git
which is correct.
3) When i tried to debug it, I opened pre-receive
script inside repo on server and tried to output variables (there is 3 of them): refs = ARGF.read
, key_id = ENV['GL_ID']
and repo_path = Dir.pwd
and found, that key_id is always empty. Maybe the problem is here... If so, please give me suggestions on how to fix that. Thanks
GitLab by default marks
master
branch asprotected
(See partProtecting your code
in https://about.gitlab.com/2014/11/26/keeping-your-code-protected/ why). If so in your case, then this can help:via https://gitlab.com/gitlab-com/support-forum/issues/40
For version 8.11 and above how-to here: https://docs.gitlab.com/ee/user/project/protected_branches.html#restricting-push-and-merge-access-to-certain-users
Might not be the case, but this was the solution to my "pre-receive hook declined" error:
There are some repositories that only allow modifications through Pull Request. This means that you have to
In my case, my team lead to created a repo(repo was empty) and assign me as developer so when I pushed to the code directly to master the error I was facing
! [remote rejected] master -> master (pre-receive hook declined)
So how it was fixed that he assigned to me as maintainer so I was able to push the code directly to the master.I solved this issue by changing
remote 'origin' url
fromhttp
togit
protocol in.git/config
To use npm to install your application's dependencies please delete the yarn.lock file.
To use yarn to install your application's dependences please delete the package-lock.json file.
A. First, ensure that you are using the correct log on details to connect to Bitbucket Server (ie. a username/password/SSH key that belongs to you)
B. Then, ensure that the name/email address is correctly set in your local Git configuration: Set your local Git configuration for the account that you are trying to push under (the check asserts that you are the person who committed the files) * Note that this is case sensitive, both for name and email address * It is also space sensitive - some company accounts have extra spaces/characters in their name eg. "
Contractor/ space space(LDN)
". You must include the same number of spaces in your configuration as on Bitbucket Server. Check this in Notepad if stuck.C. If you were using the wrong account, simply switch your account credentials (username/password/SSH key) and try pushing again.
D. Else, if your local configuration incorrect you will need to amend it
open -a TextEdit.app ~/.gitconfig
NOTE: You will have to fix up the old commits that you were trying to push.
Amend your last commit:
Try re-pushing your commits: