1

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?

Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
Potatoman
  • 23
  • 4
  • git config --global user.email johndoe@example.com – Zydnar May 01 '17 at 16:16
  • Doesn't work. I should note that (Because I didn't notice it) one of my previous commits were done under my old username / mail. But my newest commit is done under my new name / mail – Potatoman May 01 '17 at 16:24
  • Does [this](http://stackoverflow.com/q/7438313/5784831) help? – Christoph May 01 '17 at 16:59
  • No, I think that is for a different issue and it recommends the use of ssh. For now I decided to unset my credential helper using "git config --global --unset credential.helper" I'm not sure if this will wipe my old credentials as well (hopefully), but I will figure that out on a later schedule. In the meantime I will just manually input everything. – Potatoman May 01 '17 at 17:09

1 Answers1

1

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

git remote origin set-url https://username@github.com/username/repository.git

With also your password

git remote origin set-url https://username:password@github.com/username/repository.git
Manuel Schmidt
  • 2,178
  • 2
  • 15
  • 19