Tenigas' technology blog

  • Desktop
  • Linux
  • Server
  • Synology
  • VCS

Store authentication for git

Published: Do 06 Oktober 2011
Updated: So 01 November 2015
By tenigas

In VCS.

tags: Firewall Installation SSH Terminal 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.

Proudly powered by Pelican, which takes great advantage of Python.

The theme is by Smashing Magazine, thanks!