返回代码 22,致命:git-http-push-failed

3 git ssh

我在我的服务器上使用git init --bare. 我在那里添加了一些文件,然后从 myserver 克隆了我的存储库git clone http://www.example.com/mygit/repo,它完美地克隆了。现在我想推送这个目录,git push origin master但它返回代码 22。我还添加了我的 PC 的 ssh 公钥http://www.example.com/mygit/repo/.ssh/authorized_keys,但我仍然无法推送到我的存储库。

Afi*_*ilu 5

只是为了记录,因为当搜索“git-http-push failed return code 22”时,这在谷歌上排名很高:

在服务器上使用 https git 和 htpasswd ,看起来发送的用户名包含域:user@domain.tld,但预期的名称只有user

我的解决方案是将其添加到~/.netrc machine host.domain.tld login the_user_name password the_password