简体   繁体   中英

git push to gitlab ssh fails

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.

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

您是否已更新gitlab_url设置以匹配gitlab-shell / config.yml中的主机名并检查了端口号?

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 '

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM