How to solve the requested URL returned error: 403 in git repository

被刻印的时光 ゝ 提交于 2019-12-07 03:35:43

问题


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 -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
remote: Forbidden
fatal: unable to access 
'https://chantidurgam@bitbucket.org/chantidurgam/patanjali.git/': The requested 
URL returned error: 403

Completed with errors, see above.


回答1:


I had the same issue when using the git cli and sourcetree - and doing the below solved it.

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.

I am using SourceTree, so went to Tools -> Options -> Authentication

and under git saved passwords, I deleted them all.

This post can lead to other ways of doing the same as well.

Remove credentials from Git




回答2:


What also need to be checked is the access level, which should be set to write. This can happen if you were added to the repo by someone else, and they forgot to grant you the required permissions.




回答3:


Here's how I solved mine.

  1. Go to bitbucket and open the repository.
  2. At the top right corner is a "clone button"

  3. Click the button and copy the url. It will look something like this: git clone https://something@bitbucket.org/something/something.git

  4. Open your terminal for and type the following

git remote remove origin
git remote add origin https://something@bitbucket.org/something/something.git

Then just do git push. Note: Git may prompt you to do this.

git push --set-upstream origin master

Do it. I did and mine works now.



来源:https://stackoverflow.com/questions/52533318/how-to-solve-the-requested-url-returned-error-403-in-git-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!