意外的 HTTP 状态代码:403 (-1) Xcode

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

Unexpected HTTP status code: 403 (-1) Xcode

iosxcodegitgithub

提问by issam

I have this error when I push my code to Github repository by Xcode

当我通过 Xcode 将代码推送到 Github 存储库时出现此错误

回答by Honey

Before answering the question you must know:

在回答问题之前,您必须知道:

Although everyone can make a pull request, you can'tjust pushto a repository. ??You need permission.

尽管每个人都可以创建pull request,但您不能只创建push一个存储库。??您需要许可。



So this happened for me because in my Xcode, I was pushing to a remote that belonged to one of the othermembers ie I didn'thave permission to push to.

所以这发生在我身上,因为在我的 Xcode 中,我正在推送到属于其他成员之一的遥控器,即我没有推送到的权限。

You have two options:

您有两个选择:

  • Ask for permission from the owner of that remote repo/fork and have them include into one of its collaborators
  • Or Simply push to a repo that you have permission like your own repo, using the dropdown menu encircled below (and perhaps then make a pull request from there to that branch you wanted to push to)
  • 请求该远程仓库/分叉的所有者的许可,并将它们包含在其中一个 collaborators
  • 或者简单地推送到一个你有权限的仓库,比如你自己的仓库,使用下面圈起来的下拉菜单(然后可能从那里向你想要推送的那个分支发出拉取请求)

enter image description here

在此处输入图片说明

I usually run into this issue when I checkout directly from a remotebranch ie I do something like:

当我直接从远程分支结帐时,我通常会遇到这个问题,即我执行以下操作:

git checkout -b localFromUpstream upstream/someBranch

And then when I commit, Xcodeassumes that I want to push back to upstream/someBranch. But I don't permission to push to upstream/someBranch.

然后当我提交时,Xcode假设我想推回upstream/someBranch. 但我不允许推送到upstream/someBranch.

回答by emotality

HTTP code 403 means forbidden, so it is most probably incorrect credentials. So double check your username and password etc.

HTTP 代码 403 表示禁止,因此它很可能是不正确的凭据。因此,请仔细检查您的用户名和密码等。

https://en.wikipedia.org/wiki/HTTP_403

https://en.wikipedia.org/wiki/HTTP_403

回答by Harish Rathuri

Even you can make a pull request, but can't just push to a repository. ??You need permission.

即使您可以提出拉取请求,但不能只是推送到存储库。??您需要许可。

Inviting collaborators to a personal repository

邀请协作者到个人仓库

  1. Ask for the username of the person you're inviting as a collaborator. If they don't have a username yet, they can sign up for GitHub.

  2. On GitHub, navigate to the main page of the repository.

  3. Under your repository name, click Settings.

  4. In the left sidebar, click Collaborators.

  5. Under "Collaborators", start typing the collaborator's username.

  6. Select the collaborator's username from the drop-down menu.

  7. Click Add collaborator.

  8. The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.

  1. 询问您邀请作为合作者的人的用户名。如果他们还没有用户名,他们可以注册 GitHub。

  2. 在 GitHub 上,导航到存储库的主页。

  3. 在您的存储库名称下,单击设置。

  4. 在左侧边栏中,单击协作者。

  5. 在“合作者”下,开始输入合作者的用户名。

  6. 从下拉菜单中选择协作者的用户名。

  7. 单击添加协作者。

  8. 用户将收到一封电子邮件,邀请他们加入存储库。一旦他们接受您的邀请,他们将拥有对您的存储库的协作者访问权限。