Potatoman
Potatoman

Reputation: 13

How to use the correct git account in git push?

Whenever I type:

git push

I get:

remote: Permission to [username]/[project-name].git denied to [old-username].
Fatal: unable to access [https://github.com/link/.git]: the requested url returned error: 403

I think that git tries to push using [old-username] which is a github account I don't use for this project.

I'm new to git but I can't seem to find the solution. How can I get github to prompt me for my correct username and password so I can push to the remote branch my new account has access to?

Upvotes: 1

Views: 94

Answers (1)

Manuel Schmidt
Manuel Schmidt

Reputation: 2417

You can change your remote url to include your username and/or password

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

With also your password

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

Upvotes: 1

Related Questions