I know, this seems like a beginner question, but it's not. I'm using .netrc file with all the Git repositories successfully, except for the ones on SourceForge.
I can't seem to find anything in SF Documentation either.
I'm basically adding these lines to my .netrc, but it still asks for my password:
machine git.code.sf.net
login xxxxx
password xxxxx
machine api.git.code.sf.net
login xxxxx
password xxxxx
I tried all other variations I can think of, but I can't make it work. Is there anyone out there that has done this? And how?
You can try and add the protocol as well in that .netrc file (considering the Git HTTPS URL for SourceForge is https://<USERNAME>@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
):
machine git.code.sf.net
login <USERNAME>
password xxxxx
protocol https
And see if the issue persists.
Make sure the URL returned by git remote -v
(for the remote 'origin') does include your login:
git remote set-url origin https://<USERNAME>@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
^^^^^^^^^
If it does not work, try and set GIT_CURL_VERBOSE
, in order to have more information (as in this thread).
It turned out the OP purplehuman was using an SSH URL instead of an HTTPS one.
As I commented below:
- SourceForge uses SSH or HTTPS for read/write access.
- If you are using SSH, then I confirm that
.netrc
is not involved in any way: it is used only for providing username/password for a HTTPS URL, not for the SSH passphrase. For the SSH passphrase, (assuming your private SSH key is protected by a passphrase), you would need anssh-agent
, not a.netrc
file.
To switch to HTTPS:
git remote set-url origin https://<USERNAME>@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
Then the .netrc
file would be used (by curl
within the git push
).