Access a git repository over https without a password

The recommended way to access github.com or bitbucket.org is through https instead of SSH. This is fine but if you use git on the command line you will be prompted to enter your password every time you run a command against the remote git repository.

If you are running linux you can get around this by adding a file with your credentials onto the machine. You will then not be requested to enter your credentials again. This is as simple as editing ~/.netrc and adding one of the following lines.

nano ~/.netrc

For github.com use:

machine github.com login USERNAME password YOUR-VERY-SECRET-PASSWORD

For bitbucket.org use:

machine bitbucket.org login USERNAME password YOUR-VERY-SECRET-PASSWORD