1

I installed gitlab omnibus on my local Ubuntu 14.04 desktop about a month ago and have used it heavily for project management and version control. I recently tried setting the server up as a public-facing server and thus changed the hostname and updated /etc/hosts to enable this. Once this change was made, I have been unable to push to my gitlab repositories, which has unfortunately halted all progress on several projects. Upon finding this issue, I reverted the server hostname and /etc/hosts file back to their original states as a few of many steps in troubleshooting the issue. Nothing has worked yet, as I am getting prompted for the user login for git@[myserver] rather than using the SSH key that is in place and was working previously.

I have added the ssh public key through the GitLab web interface, and confirm that it is installed by inspecting the /var/opt/gitlab/.ssh/authorized_keys file and confirming that the public key is listed, and includes the extra 'command=...' portion that gitlab needs. Everything looks good with the ssh stuff to me to the best of my understanding of it. I do have working ssh keys to other user accounts on the server, and have confirmed that these are working as expected. The issues seems to be specific to gitlab rather than my general ssh service.

I have found other discussions of this issue, but no solutions offered in those have worked for me. Specifically, I have attempted to follow directions offered in the following threads:

I have spent about 3 days trying to troubleshoot this and have not made any progress. I even uninstalled and reinstalled gitlab, only to find that the uninstall didn't clear out any settings or data, and that the problem perisisted.

What can I do to get this usable again? I am happy to provide whatever details about the server and gitlab configuration are needed.

Community
  • 1
  • 1
Dan Steeby
  • 49
  • 1
  • 8

3 Answers3

4

A little bit late here but I just ran into a similar problem.

The solution for me was to use the ssh-agent and add my key (Here goes):

  1. Create key : ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  2. Enter a file in which to save the key (~/.ssh/id_rsa): [Press enter]

  3. Start ssh-agent : eval $(ssh-agent -s)

  4. Add your ssh key : ssh-add ~/.ssh/id_rsa


  1. Make sure you have added your .pub file contents to your gitlab ssh keys ( gitlab - profile settings - ssh keys )

  1. Then change your git remote to use the ssh git remote set-url origin ssh://github.com:port/username/repo.git

Done

jstleger0
  • 105
  • 1
  • 14
0

Have you updated the gitlab_url setting to match the hostname in gitlab-shell/config.yml and checked the port number?

Geoff
  • 495
  • 3
  • 12
  • thanks for the reply. My gitlab-shell/config.yml file is managed by gitlab-ctl based on settings in my /etc/gitlab/gitlab.rb file. I have made changes to the config.yml file based on your suggestions, but this file gets overwritten any time I run 'gitlab-ctl reconfigure', so they are not permanent. At first glance, my gitlab_url was set to 'http://127.0.0.1:8080', which is not at all what you suggest. I tried replacing this with my hostname and tried a variety of trailing slashes and port numbers but did not see any changes in the situation. – Dan Steeby May 08 '15 at 18:59
  • Assuming my hostname is 'ts', I tried the following values for gitlab_url without success (I am trying port 8081 because I have gitlab configured to run nginx on port 8081, and thought maybe these ports needed to match): `http://ts` `http://ts/` `http://ts:8080` `http://ts:8080/` `http://ts:8081` `http://ts:8081/` – Dan Steeby May 08 '15 at 18:59
  • I ran 'gitlab-ctl restart' between each change above in case things needed to be restarted for such changes to take place. I am not clear if the 'have you checked the port number' portion of your suggestion corresponds to my attempted port number uses above, please let me know if it does not. – Dan Steeby May 08 '15 at 19:03
  • nginx and gitlab-shell do not run on the same port. If you run `sudo netstat -l -n -p | grep tcp` you should see nginx listening on one port (8081 in your case) and unicorn.rb on another (usually 8080, per your config). Have you checked unicorn logs? – Geoff May 08 '15 at 19:56
0

I also recently ran into this issue, and was able to solve it by updating the external_url variable (originally assigned to a domain name that had yet to be registered) in my /etc/gitlab/gitlab.rb file.

Create SSH Key as suggested in link on the new project page.

original external_url variable: external_url 'http://gitlab.example.com'

updated external_url variable: external_url 'http://10.10.10.10'

mg72
  • 43
  • 6