返回码22,致命:git-http-push-failed [英] return code 22, fatal: git-http-push-failed
问题描述
我使用 git init --bare
在我的服务器上创建了自己的git repo。我在那里添加了一些文件,然后通过 git clone http://www.example.com/mygit/repo
从我的服务器克隆我的repo,并完全克隆。现在我想通过 git push origin master
来推送这个目录,但它返回的是代码22.我还将PC的ssh公钥添加到 http: //www.example.com/mygit/repo/.ssh/authorized_keys
但仍然无法推入我的回购。
I made my own git repo on my server using git init --bare
. I added some files there and then cloned my repo from myserver by git clone http://www.example.com/mygit/repo
and it cloned perfectly. Now i want to push this directory by git push origin master
but it is returning code 22. I also added ssh public key of my PC to http://www.example.com/mygit/repo/.ssh/authorized_keys
but still i can't push into my repo.
推荐答案
使用服务器上的https git和htpasswd,似乎发送的用户名包含域: user@domain.tld
,但预期的名称仅为 user
。
With https git and htpasswd on the server, it seems that the user name sent includes the domain: user@domain.tld
, but the expected name is only user
.
我的解决方案是将它添加到〜/ .netrc
:
机器host.domain.tld
登录the_user_name
密码the_password
The solution for me was to add this in ~/.netrc
:
machine host.domain.tld
login the_user_name
password the_password
这篇关于返回码22,致命:git-http-push-failed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!