Switch your git user

This might not happen often, but recently I wanted to switch my git user. Working on the same repository but initiated with a different user. To do this, you can use the terminal.

Open a terminal window and retrieve your git info with the command: git config --list

Here you should see your git repo info. I check this to copy paste the git url. You can use the command git remote set-url origin https://new-user@same-url.git to set the new user in the url.

To trigger the refresh enter the git pull command, which should prompt you for a new password (since you changed the user). Enter the correct password and after that you are good to go again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: