Git push bug

I started the gitlabhq rails server in a virtual machine by following steps 1-6 from this tutorial https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md and running the rails sudo -u git -H bundle exec rails s -e production server sudo -u git -H bundle exec rails s -e production . After that, I created a user using admin tools and created a new project under this user. Then I try to push an existing project to this repo, as always. But in the last step, git push origin master fails with an error

[remote failure] master → master (reject before receiving)

Additional Information:

1) I did not activate the user (project owner) via the email activation link, because I did not configure the server-side messaging service, and I did not find instructions on how to do this in this guide.

2) The Gitlab server generates hints on how to redirect the project to the repo, and there are no repositories/ in the 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 a pre-receive script inside the repo on the server and tried to output the variables (there are 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 tips on how to fix this. Thanks

+108
gitlab githooks
Feb 04 '15 at 10:07
source share
8 answers

The problem seems to be related to some services, such as sidekiq. Running sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production displays all the configuration problems.

+8
Feb 05 '15 at 9:36
source share

GitLab by default marks the master branch as protected (see the Protecting your code section at https://about.gitlab.com/2014/11/26/keeping-your-code-protected/ why). If so in your case, then this may help:

Open your project> Settings [> Repository tab] and go to the "Protected branches", select "Developers can click" and try again.

via https://gitlab.com/gitlab-com/support-forum/issues/40

For version 8.11 and higher with instructions here: https://docs.gitlab.com/ee/user/project/protected_branches.html#restricting-push-and-merge-access-to-termin-users

+166
Mar 03 '15 at 13:09
source share

The following problem has been resolved on my local machine:

A. First, make sure you use the correct login information to connect to Bitbucket Server (i.e. username / password / SSH key that belongs to you)

B. Then, make sure that the name / email address is correctly set in your local Git configuration: Set the local Git configuration for the account you are trying to click under (verification confirms that you are the person who committed the files) * Please note that it is case sensitive for both the name and email address * It is also case sensitive - some company accounts have extra spaces / characters in their name, for example. " Contractor/space space(LDN) ". You must include the same number of spaces in your configuration as on Bitbucket Server. Check it in a notebook if stuck.

C. If you used the wrong account, just change your account credentials (username / password / SSH key) and try again.

D. Otherwise, if your local configuration is incorrect, you will need to change it

For MAC

open -a TextEdit.app ~/.gitconfig

NOTE. You will have to fix the old commits that you tried to push.

  1. Change your last commit:

     > git commit --amend --reset-author <save and quit the commit file text editor that opens, if Vim then :wq to save and quit> 
  2. Try repeating your commits:

     > git push 
+7
Sep 26 '17 at 13:01 on
source share

You may not have developer access to the project branch or the wizard. You need developer access to activate a new job.

New work means new branches and commits.

+2
Nov 12 '15 at 7:41
source share

This may not be the case, but this was the solution to my "pre-receive hook declined" error:

There are several repositories that can only be modified through a Pull Request . That means you must

  • Create a new branch, taking as a basis the branch that you want to push your changes to.
  • Commit and push your changes to the new branch.
  • Open a Pull request to merge your branch with the original.
+1
Sep 13 '17 at 14:15
source share

You need to add your ssh key to your git account if it gives an error, then delete the previous ssh key and create a new ssh key and then add.

0
Feb 04 '15 at 11:38
source share

I solved this problem by changing the remote 'origin' url from http to git protocol in .git/config

0
Jan 07 '19 at 7:49
source share

Go to Project Settings → Hooks → (Under) Pre-Received Hooks

Disable cp require link to problem in commits

0
Jul 18 '19 at 19:46
source share



All Articles