Pages

Tuesday, 27 December 2011

Smart HTTP Support


Git's HTTP protocol just upped it a few notches on the ol' IQ test. As discussed in detail on the Pro Git blog, Git supports a new, much more efficient HTTP based transport as of version 1.6.6. Well, now GitHub supports that new protocol as well.
From now on, if you clone a repository over the http:// url and you are using a Git client version 1.6.6 or greater, Git will automatically use the newer, better transport mechanism. Even more amazing, however, is that you can now push over that protocol and clone private repositories as well. If you access a private repository, or you are a collaborator and want push access, you can put your username in the URL and Git will prompt you for the password when you try to access it.
Try it out on a public repository:
$ git clone http://github.com/schacon/grack.git
For private repos, or to have push access on your repository, you can clone this way:
$ git clone https://username@github.com/username/project.git
Don't forget the https part - Git will send your password hashed but unencrypted over the wire, so be sure to use SSL. In future versions of Git (assuming our patch gets integrated), Git will prompt you for your username if it's not provided and the client gets a 401, so you won't actually have to put your username in the URL - it will just ask you when Git needs it.
Older clients will also fall back to the older, less efficient way, so nothing should break - just newer clients should work better.
Let us know if you have any problems with it, and enjoy!

FROM https://github.com/blog/642-smart-http-support

No comments:

Post a Comment