将 Xcode 项目推送到 GitHub 时的身份验证问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11393080/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:49:37  来源:igfitidea点击:

Authentification issue when pushing Xcode project to GitHub

xcodegithub

提问by zeroliu

I encountered a problem when I wanted to push my project to GitHub via Xcode.

当我想通过 Xcode 将我的项目推送到 GitHub 时遇到了问题。

Attention, I am not talking about terminal here. I have to set the Xcode environment for the artist in my team. Terminal is not working for him...

注意,我不是在这里谈论终端。我必须为我团队中的艺术家设置 Xcode 环境。终端对他不起作用...

I tried to use the HTTPS address (https://github.com/zeroliu/DumplingJump.git) at the beginning but always receives a 403 authentification error.

一开始我尝试使用HTTPS地址(https://github.com/zeroliu/DummplingJump.git)但总是收到403认证错误。

error: The requested URL returned error: 403 while accessing https://github.com/zeroliu/DumplingJump.git/info/refsfatal: HTTP request failed

错误:请求的 URL 返回错误:403 访问 https://github.com/zeroliu/DummplingJump.git/info/refs致命:HTTP 请求失败

By searching everywhere, I found that GitHub actually only accept SSH way. But weirdly, I can use HTTPS way to push my project via Terminal...I don't think that statement is right.

到处搜索,发现GitHub实际上只接受SSH方式。 但奇怪的是,我可以使用 HTTPS 方式通过终端推送我的项目......我认为这种说法不正确。

Anyway, then I tried the SSH way but it is also not working. Xcode asked me to type in my username and password but no matter how many times I tried, it was just not working. I think the problem comes from Xcode itself, since the SSH address is in form of [email protected]:Organization/Repository.git, Xcode stupidly considers the user name is git, but not Organization...and as I change the user name when pushing the project, Xcode will automatically replace "git" by my username, which changes the address to [email protected]:Organization/Repository.git. That should be the reason why I can not get the access via SSH.

无论如何,然后我尝试了 SSH 方式,但它也不起作用。Xcode 让我输入我的用户名和密码,但无论我尝试了多少次,它都不起作用。我认为问题出在 Xcode 本身,因为 SSH 地址的形式是 [email protected]:Organization/Repository.git,Xcode 愚蠢地认为用户名是 git,但不是 Organization...并且当我更改用户时推送项目时,Xcode 会自动将“git”替换为我的用户名,从而将地址更改为 [email protected]:Organization/Repository.git。这应该是我无法通过 SSH 访问的原因。

Does anyone of you succeed in pushing the project to GitHub via Xcode? Really need your help!! Mega Thanks!!!

你们中有人成功地通过 Xcode 将项目推送到 GitHub 吗?真的需要你的帮助!!超级感谢!!!

回答by trojanfoe

I always set the github URL to:

我总是将 github URL 设置为:

https://username:[email protected]/username/Whatever.git

Which is bad for security, but I've wasted enough time trying to get SSH to work with multiple key pairs and I cannot be bothered to type my username/password every time.

这对安全性不利,但我已经浪费了足够多的时间试图让 SSH 使用多个密钥对,而且我每次都懒得输入用户名/密码。