How to set default username for HTTPS git push?

I want to click on my remote repo which is hosted on github using https. No, I do not want to use SSH or any other protocol, so please do not offer this.

Now I know that you can specify the default username in the most remote device, for example:

git remote add origin https://[Username]@github.com/[OrgName]/[RepoName].git 

However, given the default HTTPS URL, github does not contain a username, which presumably means that every developer will need to manually change the remote URL to add their username. Is there any global configuration setting that you can use to just give git a default username? If not, why does github not give you an HTTPS remote URL containing the [Username]@ ?

+7
source share
1 answer

OK, git credentials can do this. Adding this to my git configurator fixes the problem:

 [credential "https://github.com"] username = (MyUsername) 

Please note that git credentials are a relatively new feature in git released in 1.7.9 or something, so it will not work in older versions.

+12
source

All Articles