11

Is there a way to skip the username prompt when I git pull? I read about skipping the entire authentification e.g. with the help of keys or ssh agents. However, I only want to send my username. Is this somehow possible?

I contribute to a private repo a friend shared with me - if that matters. My user.name is written in the global git config and I use https protocol for the remote.origin.url.

2 Answers 2

16

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.

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .