Last Updated: February 25, 2016
·
569
· msztolcman

Git authentication for http protocol (unix-like)

There is an easy way to connect to git repositories via ssh protocol without passwords - just create public key etc. But it doesn't work if you get repository via http/https protocol. In this case, you must enter your login and password at every remote operation.

To avoid this, you can create/edit ~/.netrc file, and add there one line:

machine <host> login <username> password <password>

For example, if your repository url is:

https://github.com/mysz/try-tiny-smartcatch.git

Entry in .netrc should looks like:

machine github.com login YOUR_LOGIN password YOUR_PASSWORD