Skip username prompt when using git

For both HTTP(S) and SSH, the username can be specified as part of the URL in user@host form:

If necessary, use git remote set-url or directly edit the .git/config file.


Easiest Solution:

From your git root directory, edit the config file .git/config.

You should see a section that looks like the following:

[remote "origin"]
        url = https://xxx.xxx/xxx/xxx.git

What you want to do is add your username@ directly after the https://. As such:

[remote "origin"]
        url = https://[email protected]/xxx/xxx.git

Save and close this config file, and Git will no longer prompt you for your username when within that repo.

Tags:

Linux

Git

Login