简体   繁体   中英

Change Git Username to Connect to My Remote Repo

I worked a contract gig recently with a temporary email address and username for git repos. It's over now and the temp username seems to be messing up my old personal repositories in git.

When I try to push origin master

I get:

remote: Permission to <my-repo>.git denied to <wrong-username>.

If I look in git config --list I get the proper username and email - I can't seem to find the location of [wrong-username] and I can't get rid of it. How do I connect back to my remote repository and get rid of this old username that I won't be using in the future?

Did you try the global setup?

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

I found the answer here: Git's famous "ERROR: Permission to .git denied to user"

It's the second answer with five steps. Go to keychain access and delete anything that looks incorrect. That solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM