I am using GitHub. I created a repository and cloned it on my Ubuntu machine.
I have made an entry in the .netrc
file as follows:
machine https://github.com/xxx/yyy.git
login xxx
xxx
I am expecting that Git will not ask me for the username and password after this entry in the .netrc
file. But Git prompts for credentials even after this.
Am I missing something?
The ~/.netrc
(or %HOME%\_netrc
on Windows) file isn't enough.
It is best to use that file encrypted, with gpg
+ netrc
alone, as I did here.
Or to use a script managing the encryption.
You would need, in that second case, to:
copy the git-credential-netrc.perl
file anywhere in your $PATH
/%PATH%
,
add:
cd yourRepo
git config credential.helper "netrc -d -v"
(You can remove -d
and -v
once it is working: those are debug flags)
use your login in the remote URL:
git set-url origin https://yourLogin@github.com/yourLogin/yourRepo
See "Git - How to use .netrc file on Windows to save user and password" for the general principle of a credential "netrc" helper (Git 1.8.3+).