Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab v5.0 git push problems

I'm creating this question to help others in their search for documentation regarding two GitLab configuration problems when attempting to push an initialized repo:

1: the git user on your GitLab server requires password even after setting up an SSH Key in the GitLab frontend:

$ git push -u origin master
git@hostname's password: 

2: the gitlab-shell client seems to look in the wrong place for your repo when attempting to push (/home/git/repositories is where all repositories should be stored as specified in /home/git/gitlab-shell/config.yml):

$ git push -v -u origin master
Pushing to git@hostname:sadmicrowave/test-project.git
fatal: 'sadmicrowave/test-project.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
like image 705
sadmicrowave Avatar asked Apr 23 '13 21:04

sadmicrowave


People also ask

What does git push do in GitLab?

Use the 'git push origin' command to move the local commit to the remote GitLab repository. It's also a good idea to review the process ensure no files failed to be added to the commit. Developers can run 'git status' and 'git reflog' commands after they have performed the GitLab push of commits to origin.

What is GIT buffer size?

The default is 1MB.


1 Answers

When the SSH Key got added in the GitLab frontend I noticed it was not being added accordingly in the /home/git/.ssh/authorized_keys file. After some digging I found this https://github.com/gitlabhq/gitlabhq/issues/3120 which points out to run the following rake:

rake gitlab:shell:setup RAILS_ENV=production

Note: the reference leaves out the part RAILS_EVN=production but that is required so you don't get another error stating cannot load such file -- rb-inotify

As my git user does not have sudo access I had to run the above command from another user login with sudo and then run the following to give the proper permissions (git) back to the .ssh directory:

$ sudo chgrp -R git /home/git/.ssh
$ sudo chown -R git /home/git/.ssh

After all that, go back to the GitLab frontend, delete and recreate your SSH-Key (you can use the same public key as before).

You should see the correct record in /home/git/.ssh/authorized_keys and if you run git push -v -u origin master from your local machine you should be good now!

like image 114
sadmicrowave Avatar answered Sep 24 '22 16:09

sadmicrowave