2016-10-21 24 views
2

這有點奇怪,我不知道如何解決它。SSH建議,從多個跳躍git克隆

目前,我們有我們用它來連接到客戶跳框:

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 

該客戶再有一個本地藏匿服務器:

Host stash.customer 
    User server 
    ForwardAgent yes 
    ProxyCommand ssh -qaxT jump.customer.com nc 10.xx.xx.x2 22 

我想克隆一個倉庫我的本地機器上,目前我能夠從jump.customer.com有任何問題克隆它,見下圖:

[email protected]:~/repos $ git clone ssh://[email protected]: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://[email protected]: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,這是問題嗎?我確定隱藏不需要傳統的ssh用戶,因爲它目前沒有用戶,我可以在網絡中克隆。

TLDR;由於使用了多個跳轉,我無法在網絡內克隆本地機器上的回購。

回答

0

我解決了這個問題,爲stash.customer添加一條新記錄並在特定的存儲器端口上進行轉發。

Host stash-customer.domain.com 
User system 
ForwardAgent yes 
ProxyCommand ssh -qaxT jump.customer.com nc 10.x.xx.xx 7999