Git Push 不要求输入密码并给出 401。在控制台中内联输入密码时很好
我已经尝试过谷歌搜索和堆栈谷歌搜索,但仍然没有找到解决方案。我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们也遇到了同样的问题,解决方案是降级到 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
根据我的经验,Git 的 http 支持有很多错误(有时是由于 Git 使用的 http 库 cURL 中的错误)。如果可能,请改用 ssh。
一些猜测:
GIT_ASKPASS
环境变量已设置。.netrc
(在 Windows 上可能是_netrc
?)文件包含错误的网站密码。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:
GIT_ASKPASS
environment variable is set..netrc
(maybe_netrc
on Windows?) file used by cURL contains a wrong password for your site.