Gitlab - Xcode 无法与远程存储库连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20266294/
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
Gitlab - Xcode Can't connect with remote repository
提问by mzurita
I am having troubles when I connect with my repository through Xcode.
当我通过 Xcode 连接到我的存储库时遇到了麻烦。
I have a Gitlab version (full pre-)installed on TurnkeyLinux Virtual Appliance on a remote server. In the Gitlab Web interface, I've created a new test user: "testuser" with a password "password" and a new project "testproject". This user was assigned to this project.
我在远程服务器上的 TurnkeyLinux 虚拟设备上安装了 Gitlab 版本(完全预装)。在 Gitlab Web 界面中,我创建了一个新的测试用户:“testuser”,密码为“password”和一个新项目“testproject”。此用户已分配给此项目。
The git url project are:
git url 项目是:
HTTP: http://example.com/testuser/testproject.git
SSH: [email protected]:testuser/testproject.git
I can see the repositories folder rightly created with a "Terminal" through SSH connection.
我可以看到通过 SSH 连接使用“终端”正确创建的存储库文件夹。
Now, I want add this git repository to my Xcode repositories.
现在,我想将此 git 存储库添加到我的 Xcode 存储库中。
So, In
所以,在
XCode > Preferences > Account
I'm trying add it, using both urls and my user credentials, but always receive the following message:
我正在尝试使用 url 和我的用户凭据添加它,但总是收到以下消息:
"Authentication failed because the name or password was incorrect."
Could anyone help me?
有人可以帮助我吗?
回答by VonC
The user/password would only be needed for an http url, not an ssh one.
用户/密码只需要 http url,而不是 ssh 一个。
When using the http url to add a repo in your XCode Accounts, make sure there is no proxy which would prevent the resolution of the example.com
server.
使用 http url在 XCode Accounts 中添加存储库时,请确保没有代理会阻止example.com
服务器解析。
If it is still not working, then, as in "Authentification issue when pushing Xcode project to GitHub", try to use an url like:
如果它仍然不起作用,那么,如“将 Xcode 项目推送到 GitHub 时的身份验证问题”,请尝试使用如下网址:
https://testuser:[email protected]/testuser/testproject.git
回答by Pinolpier
Even if the problems seems solved I've found this question when I had the problem using XCode 10. I tried logging in to GitHub and got the same error. The workaround described didn't fix my problem but I've found another solution on my own which I'd like to share – maybe it helps somebody ;)
即使问题似乎已经解决,我在使用 XCode 10 遇到问题时也发现了这个问题。我尝试登录 GitHub 并遇到相同的错误。所描述的解决方法并没有解决我的问题,但我自己找到了另一个我想分享的解决方案——也许它对某人有帮助;)
My GitHub password included a '?' character (I'm German) and seems XCode and GitHub don't support the used encoding. After changing my password to something without an '?' it worked fine. Maybe it wasn't because of the '?' but it already helped to change the password- I don't know.
我的 GitHub 密码包含一个“?” 字符(我是德国人)并且似乎 XCode 和 GitHub 不支持使用的编码。将我的密码更改为没有“?”的密码后 它工作正常。也许不是因为“?” 但它已经有助于更改密码- 我不知道。
回答by mzurita
Thank you, but the reasons are Xcode seems a little crazy…
谢谢,但原因是 Xcode 似乎有点疯狂……
In
在
Xcode > Source Control > Test Project (master) > Configure Test Project…
I've just added my repository HTTP URL and credentials were not needed, and when I trying push/pull actions Xcode ask me for user/password.
我刚刚添加了我的存储库 HTTP URL 并且不需要凭据,当我尝试推/拉操作时,Xcode 会询问我的用户/密码。
Seems to be Repository in Preferences > Account doesn't work fine…
似乎是 Preferences > Account 中的 Repository 不能正常工作......
回答by tontonCD
you'd better use the projectconfiguration:
‘Source Control' > '(project name)-Master' > ‘Configure (project name)',
select ‘Remote', choose ‘+' > Add Remote
Name : origin
Address : [email protected]:xxx/yyy.git
(Curiously it appears after this in the XCode prefs)
Don't forget: using SSH, the password is the one you used (keygen) when building the key !
你最好使用项目配置:
'Source Control' > '(project name)-Master' > 'Configure (project name)',
选择'Remote',选择'+' > Add Remote
Name : origin
Address : git@ gitlab.com:xxx/yyy.git
(奇怪的是它出现在 XCode 首选项之后)
不要忘记:使用 SSH,密码是您在构建密钥时使用的密码(keygen)!
回答by Yann Bizeul
I don't want to use HTTP! Key file under "git" user is very convenient and secure, I'm not going to type my password in a unencrypted URL entry in some plist file.
我不想使用 HTTP!“git”用户下的密钥文件非常方便和安全,我不会在某些 plist 文件的未加密 URL 条目中键入我的密码。
In my case, the problem was that Xcode was trying to use the wrong key file :
就我而言,问题是 Xcode 试图使用错误的密钥文件:
.ssh/id_rsa代替
.ssh/id_dsa
回答by Giuliano Gavazzi
Here using Xcode 7.3.1 and finally managed to push using ssh (and Gogs as github server) by doing so:
这里使用 Xcode 7.3.1 并最终设法使用 ssh(和 Gogs 作为 github 服务器)进行推送:
1) select the correct private key (there must also be the public key file present)
1)选择正确的私钥(还必须存在公钥文件)
on Gogs side:
在 Gogs 方面:
2) add that same key from the Gogs user Settings->SSH Keys
2) 从 Gogs 用户设置->SSH 密钥添加相同的密钥
3) under admin panel: Dashboard: Operations: rewrite the authorised_keys file
3)在管理面板下:仪表板:操作:重写authorised_keys文件
Done
完毕