如何解决请求的 URL 返回错误:git 存储库中的 403
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52533318/
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
How to solve the requested URL returned error: 403 in git repository
提问by Kondal
I have multiple accounts in git I committed code three weeks back with this account. I'll unable to pull my code . I was getting The requested URL returned error: 403 I'll try Pushing to Git returning Error Code 403 fatal: HTTP request failed but I couldn't solved my error
我在 git 中有多个帐户,三周前我用这个帐户提交了代码。我将无法提取我的代码。我收到请求的 URL 返回错误:403 我将尝试推送到 Git 返回错误代码 403 致命:HTTP 请求失败 但我无法解决我的错误
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
remote: Forbidden
fatal: unable to access
'https://[email protected]/chantidurgam/patanjali.git/': The requested
URL returned error: 403
Completed with errors, see above.
已完成,但有错误,请参见上文。
回答by Kunal
I had the same issue when using the git cli and sourcetree - and doing the below solved it.
我在使用 git cli 和 sourcetree 时遇到了同样的问题 - 执行以下操作解决了它。
This is basically an auth issue and git had stored my creds for both bitbucket and github. All I had to do was delete those saved entries using sourcetree.
这基本上是一个身份验证问题,git 已经为 bitbucket 和 github 存储了我的凭据。我所要做的就是使用 sourcetree 删除那些保存的条目。
I am using SourceTree, so went to Tools -> Options -> Authentication
我正在使用 SourceTree,所以转到工具 -> 选项 -> 身份验证
and under git saved passwords, I deleted them all.
在 git 保存的密码下,我将它们全部删除。
This post can lead to other ways of doing the same as well.
这篇文章也可以引导其他方法来做同样的事情。
回答by Armin
回答by Omasiri
Here's how I solved mine.
这是我如何解决我的。
- Go to bitbucket and open the repository.
Click the button and copy the url. It will look something like this: git clone https://[email protected]/something/something.git
- Open your terminal for and type the following
- 转到 bitbucket 并打开存储库。
单击按钮并复制网址。它看起来像这样:git clone https://[email protected]/something/something.git
- 打开您的终端并输入以下内容
git remote remove origin
git remote add origin https://[email protected]/something/something.git
Then just do git push. Note: Git may prompt you to do this.
然后就做 git push 吧。注意:Git 可能会提示你这样做。
git push --set-upstream origin master
Do it. I did and mine works now.
做吧。我做了,我的作品现在。
回答by ce0la
git config --global --unset credential.helper
The above code worked for me. As @Kunal said, I think a reason I had this issue was as a result of saving my credentials a while back and this causing an auth issue now. I hope the code works, this stumped me for over an hour.
上面的代码对我有用。正如@Kunal 所说,我认为我遇到这个问题的一个原因是因为我保存了一段时间的凭据,这导致了身份验证问题。我希望代码有效,这让我难住了一个多小时。