Git Push 不要求输入密码并给出 401。在控制台中内联输入密码时很好

发布于 2025-01-07 08:33:18 字数 1533 浏览 1 评论 0原文

我已经尝试过谷歌搜索和堆栈谷歌搜索,但仍然没有找到解决方案。我在 Windows 下使用 Git。

当我尝试这些命令之一时:

$ git push origin master
$ git push https://name@server/git/repoName.git

即不输入密码,每次收到身份验证错误(它甚至不要求密码):

error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

当我直接提供密码(内联)时,推送工作正常:

$ git push https://name:myPasswordHere@server/git/repoName.git

如果有一些附加信息我认为可能有用的要求:

$ git remote -v
origin  https://name@server/git/repoName.git (fetch)
origin  https://name@server/git/repoName.git (push)

.gitconfig 的内容:(git config --list 实际上显示它,因此文件被读取)。

[http]
    sslVerify = false
[user]
    name = foo
    email = [email protected]

配置选项的完整列表:

$ git config --list // outside the repo
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslverify=false
user.name=foo
[email protected]

有什么提示可能是错误的吗?

I've tried googling and stack-googling for this, but haven't found the solution still. I'm working with Git under Windows.

When I try either of those commands:

$ git push origin master
$ git push https://name@server/git/repoName.git

i.e. without typing my password, each time I get the authentication error (it doesn't even ask for password):

error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

When I provide my password directly (inline), push works fine:

$ git push https://name:myPasswordHere@server/git/repoName.git

Some additional info if required that I think might be useful:

$ git remote -v
origin  https://name@server/git/repoName.git (fetch)
origin  https://name@server/git/repoName.git (push)

Contents of .gitconfig: (git config --list actually displays it, so the file is read).

[http]
    sslVerify = false
[user]
    name = foo
    email = [email protected]

Full list of configuration options:

$ git config --list // outside the repo
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslverify=false
user.name=foo
[email protected]

Any hints what can be wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初心 2025-01-14 08:33:18

我们也遇到了同样的问题,解决方案是降级到 1.7.6 或类似版本,我们在 1.7.8/9 上尝试的所有操作都以同样的方式失败

http://code.google.com/p/git-core/issues/detail?id=2

we are also having the same problem, the solution was to downgrade to 1.7.6 or similar, everything we tried with 1.7.8/9 failed in the same way

http://code.google.com/p/git-core/issues/detail?id=2

回心转意 2025-01-14 08:33:18

根据我的经验,Git 的 http 支持有很多错误(有时是由于 Git 使用的 http 库 cURL 中的错误)。如果可能,请改用 ssh。

一些猜测:

  1. GIT_ASKPASS 环境变量已设置。
  2. cURL 使用的 .netrc(在 Windows 上可能是 _netrc?)文件包含错误的网站密码。
  3. Git 或 cURL 库中存在错误。尝试更新到最新版本的 Windows 版 Git< /a> 或降级到您同事使用的相同版本。

In my experience, Git's http support has been very buggy (sometimes due to bugs in cURL, the http library used by Git). If possible, use ssh instead.

A few guesses:

  1. The GIT_ASKPASS environment variable is set.
  2. The .netrc (maybe _netrc on Windows?) file used by cURL contains a wrong password for your site.
  3. There's a bug in Git or the cURL library. Try updating to the latest version of Git for Windows or downgrading to the same version used by your coworkers.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文