Xcode - 使用 SSH 身份验证添加存储库时出现身份验证失败错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37143563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode - Authentication failed error when adding repository with SSH auth
提问by Viktor Kucera
I am trying to add repository via Xcode > Settings > Accounts and I am stuck on the proper address. Address of our repo is quite simple: my.domain.com:port/project-name. Authentication via SSH Keys. Could someone help me to understand what's going on here? See screenshot below.
我正在尝试通过 Xcode > Settings > Accounts 添加存储库,但我被困在正确的地址上。我们的 repo 的地址很简单:my.domain.com:port/project-name。通过 SSH 密钥进行身份验证。有人可以帮助我了解这里发生了什么吗?请参阅下面的屏幕截图。
By the way running git clone git+ssh://[email protected]:port/project-name works fine.
顺便说一下,运行 git clone git+ssh://[email protected]:port/project-name 工作正常。
EDIT
编辑
Running git clone without git+ssh//
在没有 git+ssh 的情况下运行 git clone //
git clone [email protected]:2222/project-name
or
或者
git clone [email protected]:22/project-name
is giving me same error:
给我同样的错误:
ssh: connect to host my.domain.cz port 22: Connection refused
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
ssh:连接到主机 my.domain.cz 端口 22:连接被拒绝
致命:无法从远程存储库读取
请确保您拥有正确的访问权限并且存储库存在。
回答by Jakuje
Xcode accepts just ssh://[email protected]:2222/project-name
.
Xcode 只接受ssh://[email protected]:2222/project-name
.
The git
protocol is somehow redundant in this case. Raw git
tools don't have a problem with it, but Xcode does not like it for some reason.
git
在这种情况下,协议在某种程度上是多余的。原始git
工具没有问题,但 Xcode 出于某种原因不喜欢它。
回答by damithH
It always fails for me when I use existing ssh keys. I created a new ssh key pair through Xcode and uploaded it to my git server (in my case, Phabricator), and it works.
当我使用现有的 ssh 密钥时,它总是失败。我通过 Xcode 创建了一个新的 ssh 密钥对并将它上传到我的 git 服务器(在我的例子中是 Phabricator),它可以工作。