How can I "login" to git?

I need to change who git thinks I am so I can push to a different repo ( both are mine. ).

Here is a similar issue but I don't want to set any config variables.

I just want to login once to my current username. I plan on deleting my other account.

Here is the error when I attempt a git push origin master

remote: Permission to current_user/fav-front.git denied to user_to_delete. fatal: unable to access '': The requested URL returned error: 403

Please note that the git config variables for user and email ( user.name and user.email ) are not related to the authentication that git push uses.

They are used for commits.

To reiterate, I want to login to git as current user.

20

2 Answers

I had a similar problem with Windows. Updating Credentials Manager helped in my case.

To open Credentials Manager search that setting or navigate to: Control Panel\All Control Panel Items\Credential Manager. In Windows Credentials -> Generic Credentials find your repo and update username/password or delete all that are not needed.

You don't login to Git.

You do login to a Git repository hosting server, which request an authentication, but Git itself has no authentication nor authorization.

What Git does have is credential caching (check the output of git config credential helper).
On Mac: "Updating credentials from the OSX Keychain": you can check if your old user was stored there, and update it.

If you really want to disable the credential helper, you will be asked your credentials every time you push to a repository hosted on a server requesting authentication.

17

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like