windows Git 不接受文件“_netrc”/“.netrc”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6903158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
File '_netrc' / '.netrc' is not accepted by Git
提问by
I have set the %HOME% environment variable on my Windows installation.
我已经在我的 Windows 安装中设置了 %HOME% 环境变量。
In that folder I have put a file called _netrc. Inside that file I have:
在该文件夹中,我放置了一个名为 _netrc 的文件。在该文件中,我有:
machine code.google.com login <logon> password <censored>
But both, MSYS and Tortoise keep asking for a password.
但是,MSYS 和 Tortoise 都不断要求输入密码。
I am using Windows 7, MSYSGit and TortoiseGit. Why does this not work?
我使用的是 Windows 7、MSYSGit 和 TortoiseGit。为什么这不起作用?
I have found an article on Stack Overflow that said it must be named _netrc and not .netrc, but none of them work.
我在 Stack Overflow 上找到了一篇文章,说它必须命名为 _netrc 而不是 .netrc,但它们都不起作用。
采纳答案by eckes
Assuming you did everything that was described in this answerand 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.
假设您执行了本答案中描述的所有操作,并且为%HOME%
环境变量设置了正确的位置(使用 确认echo %HOME%
并检查该位置是否有_netrc
文件),则存储库的使用肯定有问题。
The URL to clone a Google Code repository is https://user.googlecode.com/svn/trunk
(see this Google linkfor that).
克隆 Google 代码存储库的 URL 是https://user.googlecode.com/svn/trunk
(请参阅此 Google 链接)。
So, you have to do a
所以,你必须做一个
git svn clone https://user.googlecode.com/svn/trunk
in order to import your Google repository.
以便导入您的 Google 存储库。
回答by Brian Rogers
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.
确保您的 _netrc 文件是 Ascii 编码的。如果使用 ECHO 重定向到标准输出上的文件,Windows 将使用 UCS-2 LE BOM 文件格式。其他一些应用程序的默认设置也可能与 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.
因此,如果通过脚本创建此文件,请使用Set-Content -Encoding Ascii
而不是 STOUT 重定向。如果通过 notepad++ 或 vim 创建此文件,请确保将编码设置为 ASCII。