Git clone using http with user and password

11,822

Solution 1

have you tried http://user%40home.com:[email protected]/git

Solution 2

This is pretty old question but let me add the workaround for benefits of others. We recently started using email id as username to connect to Git, but pull/fetch/push etc commands started failing. We tried %40 as suggested in previous comments but it didnt work. So we created ~/.netrc file with following information.

machine git.myserver.com login [email protected] password mypassword

We also removed username from the url which gets stored in .git/config file. And we could now do pull/commit etc. Its not advisable to use this approach because password is stored in plain text in a file but that was a quick workaround to make urgent commit while looking for ways to connect using email id from command line tool.

Share:
11,822
Bernd Klaus
Author by

Bernd Klaus

Updated on June 06, 2022

Comments

  • Bernd Klaus
    Bernd Klaus almost 2 years

    I try to use git clone http://user:[email protected] but I have some problems with adding user or password because the user is using email which contains an other @ and password is using an esclamation mark ( ! )

    the command looks like http://[email protected]:[email protected]/git

    This is not working - I tried 0x21password instead of !password but the system don't except this.

    Any idea?

  • Bernd Klaus
    Bernd Klaus almost 13 years
    looks like my remote repository is not decoding the string correctly. Is it possible to use a netrc file on windows?
  • Russell Troywest
    Russell Troywest almost 13 years
    Sorry Bernd, I don't know - this isn't really my area of expertise. I just thought the encoding might help...
  • Bernd Klaus
    Bernd Klaus almost 13 years
    sure - thanks again for the help! Accidently the backend is not working like expected. Otherwise this should work like this.