简体   繁体   中英

git keeps using the wrong credentials for Github push

I have several repositories that I upload to Github on my Account A.

I opened a second Github account, Account B. I cloned a private repo using https://accountb:accountbpassword@github.com/... so it would use my Account B instead of Account A.

Now when I try to push anything to repos on my Account A, I get error 403.

Permission to AccountA/SomeRepo denied to AccountB

I can't figure out how Git is deciding which user to use when pushing. If I'm in one of my repos for Account A, and I look at the remote address, it does not include the user in the address.

I'm on Windows. Git was pulling my Github account info from Credential Manager. Apparently, when I cloned the other repo, including the username and password in the remote address, it updated my Github credentials in Credential Manager.

I deleted the Github entry in Credential Manager, and the next time I pushed, it let me enter my login info again.

I suppose the equivalent to Credential Manager on macOS would be Keychain.

More info here on SuperUser.

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