这有点奇怪,我不知道如何解决它。
目前,我们有一个跳线盒,用于连接客户:
Host jump.server.com
Hostname jump.server.com
ForwardAgent yes
ForwardX11 yes
User first.last
Port 22
DynamicForward 9999
然后我连接到我的客户:
Host jump.customer.com
User server
ForwardAgent yes
ProxyCommand ssh -qaxT jump.server.com nc 10.xx.xx.x1 22
该客户随后拥有本地 Stash 服务器:
Host stash.customer
User server
ForwardAgent yes
ProxyCommand ssh -qaxT jump.customer.com nc 10.xx.xx.x2 22
我想在我的本地计算机上从存储中克隆一个repo,目前我能够从 jump.customer.com 克隆它,没有任何问题,见下文:
server@jump.customer.com:~/repos $ git clone ssh://git@stash.customer:7999/cm/repo.git
Cloning into 'repo'...
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 37 (delta 22), reused 0 (delta 0)
Receiving objects: 100% (37/37), 5.41 KiB | 0 bytes/s, done.
Resolving deltas: 100% (22/22), done.
Checking connectivity... done.
但是,当我尝试在本地计算机上执行此操作时,我得到以下内容:
└─ $ ▶ git clone ssh://git@stash.customer:7999/cm/repo.git
Cloning into 'repo'...
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
起初我认为这意味着我的密钥不在此存储库的存储服务器上,但是我查看了 stash.customer
上的安全日志Oct 21 09:42:48 stash.customer sshd[24122]: Invalid user git from 10.xx.xx.1
Oct 21 09:42:48 stash.customer sshd[24123]: input_userauth_request: invalid user git
Oct 21 09:42:49 stash.customer sshd[24123]: Connection closed by 10.xx.xx.1
在存储服务器或跳转机器上没有用户名为git,这是问题吗?我确定stash不需要传统的ssh用户,因为它目前没有,我可以在网络中克隆。
TLDR;由于使用了多次跳转,我无法仅在网络内克隆本地计算机上的存储库。
答案 0 :(得分:0)
我通过为stash.customer添加新记录并在特定的存储端口上转发来解决这个问题。
Host stash-customer.domain.com
User system
ForwardAgent yes
ProxyCommand ssh -qaxT jump.customer.com nc 10.x.xx.xx 7999