Gandharv Suri
Gandharv Suri

Reputation: 147

remote: Permission to repository denied. URL returned error: 403

Might be a duplicate question, but none of the available solutions seems to be working. Could be that Github changed Support for password since 13 Aug, 2021.

I have tried the following:

  1. Checked the username and password.
  2. Created a Personal Access Token.
  3. Rechecked the origin URL in .git/config file.

The error message:

Username for 'https://github.com': gandharvsuri
Password for 'https://[email protected]': 
remote: Permission to gandharvsuri/gandharvsuri.github.io.git denied to gandharvsuri.
fatal: unable to access 'https://github.com/gandharvsuri/gandharvsuri.github.io.git/': The requested URL returned error: 403

Upvotes: 11

Views: 127548

Answers (12)

Sharath Pawar
Sharath Pawar

Reputation: 1

  1. Press: Windows + R
  2. Enter this command: control /name Microsoft.CredentialManager
  3. Navigate to Windows Credentials you'll find git Credentials -> REMOVE it
  4. In VsCode terminal enter this command: git remote add origin <-url-of-your-repository->

you'll be navigated to account setup page.

Upvotes: 0

Abhijit Parida
Abhijit Parida

Reputation: 1

Go to Control Panel\All Control Panel Items\Credential Manager>Windows Credentials

Next>> delete the existing git hub credential

next>> again run the command git push or push from your code environment.

next>> it will ask for authentication

next>> enter your credentials

that's it, it will be done.

Upvotes: 0

parth
parth

Reputation: 41

I found solution of this problem.

Sometimes, it is because of not being able to get proper credentials from Windows Credentials Manager.

If so,

  1. Open Credential Manager by running the following at the command line:

    • Windows+R to enter the command:
    • control /name Microsoft.CredentialManager
  2. Manage git credentials

    enter image description here

  1. Restart git credentials

Upvotes: 4

leonard adi
leonard adi

Reputation: 229

First you need to generate a new token.

My account - Setting - Developer Setting - Personal Access Token - Generate New Token

After you generate the token,

git remote set-url origin https://<token>@github.com/<username>/<repo>

For example,

git remote set-url origin https://ghp_
[email protected]/GitHubUser/AwesomeRepo

Upvotes: 21

Raghib Najmi
Raghib Najmi

Reputation: 9

ssh-keygen -t rsa -b 4096 -C "[email protected]"

git remote set-url origin [email protected]:/.git

ssh -T [email protected]

test ssh git remote set-url origin [email protected]:ragOP/vc.git

Upvotes: -1

QVChenz
QVChenz

Reputation: 1

provide an idea . make sure the ssh key was add into the github_account truely. then change the remote URL to the ssh ,the command following:

git remote set-url origin [email protected]://<Repositories.git>

Upvotes: 0

Nick M
Nick M

Reputation: 1

I found success doing this within my codespace by just setting up ssh keys to github. Essentially I just ran the following commands:

ssh-keygen

I then enter till the key was generated. Then changed into the directory to get the public key.

cd /home/codespace/.ssh
cat id_rsa.pub

I copied that and threw it under my profile for ssh keys. You may have to re clone down your repo using ssh after this but this is a good solution if your using multiple git repos within your codespace! I'm currently using my codespace for a class and whenever I'm not programming I turn it off to avoid going over my free 60 hours.

Upvotes: 0

Rafflesia
Rafflesia

Reputation: 21

I got the same error, I use the SSH e.g., [email protected]:Example/Name-Of-Repo.git, instead of the HTTPS.

Upvotes: 1

codingdrizzle
codingdrizzle

Reputation: 19

Try not pushing with VScode terminal or being signed in to a vscode account. Open a bash terminal/window and push from there. this worked for me.

Upvotes: 1

Alex van Winkel
Alex van Winkel

Reputation: 41

The solution for me was to make sure the git remote url was set properly:

git remote set-url origin <blabla.git>

After that, it worked like a charm...

Upvotes: -1

Fortune
Fortune

Reputation: 411

This worked for me

When creating your Personal Access Token, ✅Check some of the checkboxes e.g

  1. ✅repo
  2. ✅workflow
  3. ✅user
  4. ✅write:discussion
  5. ✅admin:enterprise
  6. ✅admin:gpg_key

Well this worked for me Try this

Upvotes: 37

Angerato
Angerato

Reputation: 155

I got the same error for https connection. When I clone repo with ssh the problem was fixed.

I followed this link to generate SSH key-pair.

After you done that step on the link above:

ssh -T [email protected]

You're ready to use SSH.

Now I used VSCode to clone my repo. You can follow anyother tool or terminal as well.

Y

When the VSCode is opened, click to Clone Git Repository...

After that you can see the following:

clonePath

Now here, you need to enter your repos' SSH connection:

enter image description here

Just copy and paste that link and your repo will be cloned with SSH protocol. Thus, you can use VSCode or Github Desktop to push or pull or for any other request without https (Autentication token).

Upvotes: 3

Related Questions