9

When I do a git push I come up with this error:

error: The requested URL returned error: 400 while accessing https://github.com/nathandunn97/SchoolAdvisor.git/info/refs?service=git-receive-pack fatal: HTTP request failed

I am using Ubuntu 13.04 and my git version is 1.8.1.2.

Liam
  • 27,717
  • 28
  • 128
  • 190
Nathan Dunn
  • 336
  • 2
  • 3
  • 12

2 Answers2

5

I has something similar to this on an internally hosted git repository (so I am not 100% sure it will fix your problem on github). "Git pull" worked fine, but "git push" gave me:

error: The requested URL returned error: 400 while accessing http://10.3.231.11/fisheye/git/myrep.git/info/refs

What worked for me was going into.git/config, and changing the url to include my username in the url:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = http://username@10.3.231.11/fisheye/git/myrep.git

It then asked for a password after the push command, then pushed the files successfully.

wobbily_col
  • 11,390
  • 12
  • 62
  • 86
  • Your comment made me open the config in 'sublime text' - showing me strange ESC markings behind the URLs. After removing them, it all worked again. Thanks! – BananaAcid Apr 19 '16 at 04:09
  • In my case there was a whitespace behind the URL. After removing that whitespace it worked again. Thanks for the hint! – JanDotNet Jul 15 '16 at 13:04
1

When you do a push with https you might need to write your password every time. generate ssh keys for git hub

https://help.github.com/articles/generating-ssh-keys

and then update your config file to the ssh url and you should be able to push your content.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • Can the downvoter maybe explain why this is wrong? I am experiencing a similar problem, and there is no answer at the moment. – wobbily_col Aug 20 '15 at 08:10