How to solve the requested URL returned error: 403 in git repository
Solution 1
What needs to be checked before anything else 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.
Solution 2
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.
Solution 3
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.
Solution 4
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
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 --set-upstream origin master
Do it. I did and mine works now.
Solution 5
Reset the git credentials: If its ubuntu system:
Unset the username and password
git config --global --unset credential.helper
git config --unset credential.helper
Open the .git-crendentials and remove existing username and password
vim ~/.git-credentials
https://username:[email protected]
to https://mygit.github.com
Store git credentials again:
git config --global credential.helper store
git pull
If it is windows:
Go to Control Panel\User Accounts\Credential Manager In under Generic Credentials, You can see the stored git passwords and remove it.
Related videos on Youtube
Kondal
LeetCode Good resources to learn JavaScript & Co Eloquent JavaScript You-Dont-Know-JS Better Web Doc Programming Enthusiast.
Updated on July 09, 2022Comments
-
Kondal almost 2 years
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://[email protected]/chantidurgam/patanjali.git/': The requested URL returned error: 403
Completed with errors, see above.
-
phd over 5 years
-
Hugo Delsing almost 5 yearsI have noticed that bitbucket sometimes takes up to 10 minutes before a newly added user to a repositiory can "pull", although it is already visible from the web interface. I'd advise anybody running into an unexpected 403 to give it some time before taking other steps.
-
-
Ravi Vaniya over 3 yearsthx @armin, I was struggling for an hour, even I have changed my password as sometimes it was saying that my password is wrong. +1 for saving my day.
-
ANONYMUS over 3 yearsWell explained!
-
tjwrona1992 over 2 yearsYup deleting all saved passwords in SourceTree worked for me! Thanks! Been struggling with this issue for nearly an hour now lol