7

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.

11

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

  • https://user@example.com/repo.git

  • user@example.com:repo.git

    (Yes, git@github.com means that the SSH username is always git when using GitHub.)

  • ssh://user@example.com/repo.git

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

1

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://username@xxx.xxx/xxx/xxx.git

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.