Getting rid of error 400 messages with git (and stash)

If you have problems pulling or pushing code from a Stash Git origin, you’re most probably using an old version of git, prior to version 1.8.

The reason for the 400 (Bad Request) error is that stash expects the new http authentication scheme, while older git clients provide the basic http authentication scheme. This affects pull, push and clone git commands.

This is particularly a nuisance with Mac OS X users, as git is bundled with Xcode. To check which version you’ve got, just run the following command:

git –version

It will most likely then not reply:

git version 1.7.9.6 (Apple Git-31.1)

OK. So now you need to either build git yourself by pulling git from github:

git clone git://github.com/gitster/git.git

and then build it:

sudo make prefix=/usr install install-doc install-html install-info

If you prefer to install prepackages binaries, you will ant to use MacPorts, which you can download from http://www.macports.org/

After Installing, run

sudo port selfupdate

and then

sudo port install git-core

The new Git binary is in /opt/local/bin so make sure to relink /usr/bin/git to /opt/local/bin/git

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s