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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 1
    I have set the %HOME% already some time ago. So, yes there where multiple restarts. And yes, cmd echoes what is expected: http://h5.abload.de/img/echoy8j5.png –  Aug 01 '11 at 19:29
  • http://h4.abload.de/img/yesiamsure8pe1.png Yes, I am sure –  Aug 01 '11 at 19:51
  • 2
    Okay, I found the mistake. I had scorcher24@code.google.com in the url. That blocked git from using my .netrc. Thanks eckes. –  Aug 01 '11 at 20:39
  • I've had the same issue, but with Cygwin git this solution did not work, FYI – Joshua Davis Nov 19 '12 at 21:30
  • You question answered my question... from it I knew that I should name the file only `_netrc`. Git Bash picked it right away! Thanks. – Leniel Maccaferri Mar 23 '14 at 04:05

2 Answers2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
eckes
  • 64,417
  • 29
  • 168
  • 201
2

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.

  • 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. – aah134 Mar 15 '22 at 08:29