Saving username and password with TortoiseGit

Saving your login details in TortoiseGit is pretty easy.  Saves having to type in your username and password every time you do a pull or push.

1. Create a file called _netrc with the following contents:

machine github.com
login <login>
password <password>

2. Copy the file to C:\Users\<your-username> (or another location; this just happens to be where I’ve put it)

3. Go to command prompt, type setx home C:\Users\<your-username>

Note: if you’re using something earlier than Windows 7, the setx command may not work for you.  Use set instead and add the home environment variable to Windows using via the Advanced Settings under My Computer.

12 thoughts on “Saving username and password with TortoiseGit

  1. Pingback: Saving Credential in TortoiseGit | ariapura.net

  2. Hi,
    Great post, very useful.

    I struggled a little bit letting it work on codeplex and found out you need to mention the sub domain (of course, silly me) as well. So machine name would be git01.codeplex.com in my case.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>