[Solved] Git .netrc file authentication issue
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?
Solution #1:
The ~/.netrc
(or %HOME%_netrc
on Windows) file isn’t enough.
You would need 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://[email protected]/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+).
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .