File '_netrc' / '.netrc' is not accepted by Git
Asked Answered
I

2

7

I have set the %HOME% environment variable on my Windows installation.

In that folder I have put a file called _netrc. Inside that file I have:

machine code.google.com login <logon> password <censored>

But both, MSYS and Tortoise keep asking for a password.

I am using Windows 7, MSYSGit and TortoiseGit. Why does this not work?

I have found an article on Stack Overflow that said it must be named _netrc and not .netrc, but none of them work.

Idyllic answered 1/8, 2011 at 19:11 Comment(5)
I have set the %HOME% already some time ago. So, yes there where multiple restarts. And yes, cmd echoes what is expected: h5.abload.de/img/echoy8j5.pngIdyllic
h4.abload.de/img/yesiamsure8pe1.png Yes, I am sureIdyllic
Okay, I found the mistake. I had [email protected] in the url. That blocked git from using my .netrc. Thanks eckes.Idyllic
I've had the same issue, but with Cygwin git this solution did not work, FYIElinoreeliot
You question answered my question... from it I knew that I should name the file only _netrc. Git Bash picked it right away! Thanks.Aubigny
Z
5

Assuming you did everything that was described in this answer and you set the right location for your %HOME% environment variable (confirm this with an echo %HOME% and check that in that location there's a _netrc file), there must something be wrong in the usage of your repository.

The URL to clone a Google Code repository is https://user.googlecode.com/svn/trunk (see this Google link for that).

So, you have to do a

git svn clone https://user.googlecode.com/svn/trunk

in order to import your Google repository.

Zavala answered 2/8, 2011 at 6:38 Comment(0)
I
3

I've been bashing my brains against this one too and I have a solution different from those posted.

Ensure that your _netrc file is Ascii encoded. If using ECHO redirecting to a file on standard out, Windows uses the UCS-2 LE BOM file format. Some other apps might also have a different default from Ascii.

So, if creating this file via script, use Set-Content -Encoding Ascii rather than a STOUT redirect. If creating this file via notepad++ or vim, ensure the encoding is set to ASCII.

Isodimorphism answered 30/3, 2020 at 17:43 Comment(2)
this one saved me my work, I had a script to generate _netrc content, and works fine on a machine, then when tried on a different machine, nothing works, I did everything. until I found your comment, and then finally all hope restored. BTW it wasnt that clear how to use the command to be honest.Soteriology
that's a very important clue, thank you. I had the files at the right location and with the right content but it didn't work. Switching to ASCII made it work.Clichy

© 2022 - 2024 — McMap. All rights reserved.