Reset Github User for Push

There are times when you need to have multiple different repository accounts for github and moving between them can be a bit of a problem. Here is my solution.

Published

February 16, 2023

So I was working on a repository at home that I set up on another github acount, for another entity. In doing so, I clobbered my global github user and user.email values and as such when I tried to git push none of the changes would go because it could not authenticate. Instead I got this:

rodney$ git push
remote: Permission to dyerlab/DLabWebsite.git denied to windbunny.
fatal: unable to access 'https://github.com/dyerlab/DLabWebsite.git/': The requested URL returned error: 403

So, what you have to do is reconfigure the username, user.email, and remote.origin.url to reset your user name for ssh/https pushing.

rodney$ git config user.name dyerlab
rodney$ git config user.email rjdyer@vcu.edu
rodney$ git config remote.origin.url https://dyerlab@github.com/dyerlab/DLabWebsite.git

Then the next time you push it (go Salt-n-Pepper), it will ask for your authentication token again. Enter it and you are good.