Unable to push a git repo via HTTP

2020-02-09 18:16发布

问题:

I am behind a firewall that allows only HTTP/HTTPS. Although I am able to pull git repos via HTTPS, I am unable to push them via HTTP/HTTPS. Though the repo is hosted on github, which allows this, I get an error. Here is the error that I get:

user@ubuntu:~/crazykdeme/mirrored/news$ git push -u origin master
XML error: not well-formed (invalid token)
error: no DAV locking support on https://github.com/mynick/news.git/
fatal: git-http-push failed

回答1:

I manage to push just fine to GitHub behind proxy, with an https address.

However, you need a Git 1.6.6+ in order to support the smart-http protocol:
See "Cannot push Git to remote repository with http/https" for more, and "Git push over HTTP not activating remote hooks" for the general idea and advantage of smart http.

To know all the variables you need to setup in order for thyat push to success:
See "Cannot get Http on git to work":

  • http_proxy
  • https_proxy
  • http.sslcainfo
  • $HOME/.netrc (or %HOME%/_netrc on Windows)