Avoid typing user name when committing to GitHub repository
Published on:
I use different accounts and different computers to work with GitHub repositories, so sometimes I face the situation when I don’t have my SSH key generated for the current environment.
I can still work with my command line tool, however I have to type credentials every time I want to pull or push to the remote.
Actually I’m fine with typing the password, but not the user name. So what can I do (besides generating new SSH key and adding it to my Git/GitHub account) is to update the remote to have my user name in it.
First of all let’s check what is the value of origin url.
git config remote.origin.url
We’ll get something like that:
https://github.com/OWNER/repo.git
Now we can update the origin url.
git config remote.origin.url https://[email protected]/OWNER/repo.git
Your user name, repository owner and repository name will be different.
And the user name is not needed any more.