我有权访问可以访问GIT服务器的SSH帐户,并能够在此SSH登录中克隆/推/拉回购。然而,我无法从别处访问此回购。
I have access to an SSH account that can access a GIT server and am able to clone/push/pull the repo in this SSH login. However I cannot access this repo from elsewhere.
在我使用的SSH账户中,
On the SSH account I use,
git clone git@gitserver:proj/myrepo.git克隆回购。
我尝试使用另一台机器设置一个ssh隧道到git服务器,
I tried setting up a ssh tunnel to the git server from another machine using,
ssh -L 3333:gitserver:22 userid@sshserver git clone ssh://localhost:3333/proj/repo.git然而,我一直提示输入用户'git'的密码。任何想法我在这里做错了吗?
However I keep getting prompted for a password for the user 'git'. Any ideas what I am doing wrong here?
推荐答案当您这样做时:
When you do this:
git clone git@gitserver:proj/myrepo.gitssh客户端在本地主机('sshserver')上启动,并使用公钥认证与'gitserver'进行身份验证。如果提示输入用户'git'的密码,那意味着公钥认证失败,并且ssh正在进入下一个方法,即密码认证。
an ssh client is starting on the local host ('sshserver') and authenticating with 'gitserver' using public key authentication. If you get prompted for a password for user 'git', that means public key authentication has failed, and ssh is falling through to the next method, which is password authentication.
公钥认证失败的最可能原因是ssh客户端没有所需的私钥。我在这种情况下,关键需要作为git的@ gitserver认证怀疑存在于sshserver:的〜/ .ssh,在这种情况下,当您试图克隆回购,将无法使用ssh客户端开始你的本地主机上通过你的ssh隧道。
The most likely reason that public key authentication would fail is that the ssh client does not have the private key needed. I suspect in this case that the key needed to authenticate as 'git@gitserver' resides in sshserver:~/.ssh, in which case it would not be available to the ssh client started on your local host when you try to clone the repo through your ssh tunnel.
为了解决这个问题,你需要让客户端访问合适的密钥。您可以将它添加到〜/ .ssh本地,或将其加载到ssh代理中。
To solve this, you need to give that client access to the appropriate key. You could add it to ~/.ssh locally, or load it into an ssh agent.
更多推荐
通过SSH隧道访问Git仓库
发布评论