5

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
hytriutucx
  • 1,614
  • 6
  • 26
  • 37
  • Here is a similar question, but it is quite deadend http://stackoverflow.com/questions/1307864/git-push-to-github-failing-seems-to-be-trying-to-use-http – hytriutucx Feb 11 '12 at 19:35
  • Do you have the latest version of git? I've gotten odd git errors in the past and the newest version always fixed them. – siannopollo Feb 11 '12 at 20:00
  • @siannopollo: my git version is git version 1.7.5.4 That is quite new, I guess – hytriutucx Feb 12 '12 at 04:51
  • Got this because the url in .git/config was incorrect. Changed the URL to git@git:myreponame and it started working correctly. Useless error message – garryp Aug 09 '16 at 15:52

3 Answers3

4

2012: 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)

2023: Do not forget that, since Aug. 2021, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.

So make sure to use a PAT (Personal Access Token) as password.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

If you you have Two-Factor Authentication (2FA) enabled, check your personal access token's validity. As personal access tokens are used to authenticate against Git over HTTP.

-1

Check if you have some kind of vpn or extra security in the repository that you are pushing, in my case it was in gitlab and had some company security settings, and I had to activate the vpn of the same after that I was able to access the repository and make the push