Store authentication for git

Store authentication for git

Create a text file called netrc in your home directory (e.g. c:\users\kannonboy_netrc). cURL has problems resolving your home directory if it contains spaces in its path (e.g. c:\Documents and Settings\kannonboy). However, you can update your %HOME% environment variable to point to any directory, so create your _netrc in a directory with no spaces in it (for example c:\curl-auth) then set your %HOME% environment variable to point to the newly created directory.

Add credentials to the file for the server or servers you want to store credentials for, using the format described below:

machine stash1.mycompany.com
login myusername
password mypassword
machine stash2.mycompany.com
login myotherusername
password myotherpassword

Linux or OS X

Create a file called .netrc in your home directory (~/.netrc). Unfortunately, the syntax requires you to store your passwords in plain text - so make sure you modify the file permissions to make it readable only to you.