推送Gitlab回购时,ssh连接失败 [英] ssh connection failing when pushing on a Gitlab repo
问题描述
我已安装 GitLab 。假设我将它安装在 / home / myuser / gitlab
中。
- 新项目
- 我被告知要创建一个存放在
/ home / myuser / gitlab / test
- 我在
/home/myuser/.ssh
- 中添加了一些SSH密钥然后我初始化了一个Git在
/ home / myuser / gitlab / test
。 - 的回购中,我添加了一个远程
git @ localhost:root / testing.git
但是当我尝试推送时,我收到以下错误消息:
$ git push -u origin master
ssh:连接到主机localhost端口22:连接被拒绝
致命:无法从远程存储库读取。
请确保您拥有正确的访问权限
并存在存储库。
我在OS X中安装了GitLab,并且在 / home中有其他SSH密钥/myhome/.ssh
,我在 /home/myuser/gitlab/.git/config
中设置了用户邮件和名字,将这些全局设置为仅用于测试),并从 / home / myuser / gitlab
启动服务器。如果我运行 ssh git @ localhost
,我会得到 / p>
/home/myhome/.ssh/config第4行:垃圾在行尾; 家。
在这个文件中,我为另一个项目设置了远程服务器。我认为这是问题,但我不知道如何解决它。
更新:以下是我的〜/ .git的内容/ config
file
主机remote_test_server
主机名remote_test_user@ftp.remote_test_server
IdentityFile〜/ .ssh / id_rsa_stf.pub
User< your home acct>
/ home / myhome /.ssh/config第4行:垃圾在行尾; home。 这会阻止任何ssh命令正常工作,因为远程会话会产生寄生回声。 检查 I have installed GitLab. Suppose I installed it in
I installed GitLab in OS X and I have other SSH keys in If I run where in this file I have some settings for a remote server for another project. I think it is the problem but I don't really know how to fix it. Update : Here's the content of my
/home/myhome/.ssh/config line 4: garbage at end of line; "home". That would prevent any ssh command to properly function, because of a parasite echo done by the remote session. Check your check also the content of your See this example of a config file: 这篇关于推送Gitlab回购时,ssh连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
.profile
或其他 .rc
文件,并查看是否有任何回应完成。
或者至少用 ssh -T git @ localhost
,以禁用任何TTY分配。 检查你的 .ssh / config $ c的内容$ c>文件,该文件似乎没有正确格式化。
用户
它应该不是
IdentityFile
应该引用私钥(〜/ .ssh / id_rsa_stf
),不是公共的!
主机名
应该引用远程服务器' ftp.remote_test_server
',而不是用户@ rem oteServer。/home/myuser/gitlab
.
/home/myuser/gitlab/test
/home/myuser/.ssh
/home/myuser/gitlab/test
.git@localhost:root/testing.git
but when I try to push, I get this error message:$ git push -u origin master
ssh: connect to host localhost port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
/home/myhome/.ssh
, I have set up the user email and name inside /home/myuser/gitlab/.git/config
, (and set those globally just for testing) and the server is launched from /home/myuser/gitlab
. Does anybody have an idea where this error comes from?ssh git@localhost
, I get/home/myhome/.ssh/config line 4: garbage at end of line; "home".
~/.git/config
fileHost remote_test_server
Hostname remote_test_user@ftp.remote_test_server
IdentityFile ~/.ssh/id_rsa_stf.pub
User <your home acct>
.profile
or other .rc
files, and see if any echo is done in those.
Or at least, test with ssh -T git@localhost
, in order to disable any TTY allocation..ssh/config
file, which doesn't seem to be properly formatted.User
should be the login name of the account used for the ssh session on the rmeote server.
It should not be the homedir path.IdentityFile
should reference the private key (~/.ssh/id_rsa_stf
), not the public one!Hostname
should reference the remote server 'ftp.remote_test_server
', not the user@remoteServer.