Of the many Platform-as-a-Service innovations Heroku has contributed in its seven year existence, perhaps the most iconic is
git push heroku master. Today we’re announcing a significant upgrade to Heroku’s Git implementation: Beta support for Git’s HTTP transport.
HTTP Git has some notable advantages over traditional SSH Git. Instead of relying on port 22 (often blocked by firewalls) HTTP Git runs on port 443, the same port used for secure web requests.
Also, HTTP Git uses a simpler authentication model than SSH Git, and is easier to set up. Many new users struggle with the tooling and configuration required to configure git-push over SSH, especially on Windows. HTTP Git uses Heroku API tokens for authentication, and Heroku Toolbelt takes care of setup and configuration so that you’re not prompted for your password on each push. See the Authentication section on Dev Center for details on how auth is managed.
Heroku Toolbelt has been updated and can be used to configure Git remotes that use HTTP. While in beta, you get HTTP by passing the
--http-git flag to the relevant
heroku git:clone and
heroku git:remote commands. To create a new app and have it be configured with a HTTP Git remote, run this:
$ heroku apps:create --http-git
To change an existing app from SSH to HTTP Git, simply run this command from the app’s directory on your machine:
$ heroku git:remote --http-git Git remote heroku updated
Check out the Dev Center documentation for details on how set up HTTP Git for Heroku.
The idea that Git can be used to deploy code to production is profound: It takes a process that you use many times a day to sync source code with collaborators, and applies it to deployments. This means that you don’t have to break flow and use different and unfamiliar tools to deploy. The result is that you’ll tend to deploy smaller changes more frequently (as opposed to giant, infrequent deploys), and that makes deploys less risky and bugs easier to identify and fix.
And because deployments derive directly from your revision control system, it’s very simple to determine what code is running on production. Simply run
git checkout <deployed-commit> and you can start to reproduce a production issue with your app locally.
We’re very happy with the HTTP Git experience we’re launching into beta today, and we feel it’s on par or better than SSH Git across all the operating systems that Heroku supports. Once HTTP Git is out of beta, we expect to make it the default Heroku Git mode.
If you have feedback or suggestions for HTTP Git on Heroku, then don’t hesitate to get in touch on email@example.com.