Upcoming Changes to GitHub Services

We are finishing up a new GitHub Services backend, dubbed "Hookshot", to increase the speed and reliability of our delivered payloads. We are doing what we can to make this a seamless transition for everyone. However, there are a few notable changes.

  • There is a new Meta API endpoint listing the current public IPs that hooks originate from.

  • We're removing the AMQP service from GitHub. It hasn't worked in quite some time, and the code it uses doesn't work in our background workers.

  • We're also instituting a new guideline to improve the reliability and maintainability of services in the future. As of today, all new services must accept an unmodified payload over HTTP. Any service that does not will be rejected. To see an example of an acceptable service, check out Code Climate. Notice their service simply accepts HTTP POST from GitHub unmodified. For an example of a service that won't be accepted after today, check out Campfire. It uses other Ruby gems and contains custom logic to transform the GitHub payload to Campfire messages. Existing hooks will keep working (don't worry 37signals, we :heart: Campfire).

We're making these changes because we want to focus on the reliability of the core Services backend for everyone. Maintaining custom logic and libraries for over 100 services is taking too much of this focus away.

User Agent mandatory from March 4th 2013

  • January 31, 2013
  • Avatar for agh agh

Following on from our previous post about requiring requests to include a valid User Agent header we will soon be changing our API servers to return HTTP 403 to any clients not providing a valid User Agent header.

We will be making this change on Monday, March 4th 2013.

Setting this helps us identify requests from you, and get in touch with people who are using the API in a way which causes disruption to GitHub. Most HTTP libraries and tools like cURL already provide a valid header for you, and allow you to customize it, so this will not require many of our users to make any changes whatsoever.

If you have any questions or feedback, please drop us a line.

New User scopes

We've added a few new user scopes for 3rd party applications that want very specific user functionality. The user:email scope gives apps read-only access to a user's private email addresses. The user:follow scope lets a user follow and unfollow other users.

This should help keep applications from requiring the user scope, which can be potentially dangerous.

We also added a read-only endpoint to get a user's public SSH keys.

GET https://api.github.com/users/technoweenie/keys

Diff and patch media types

Starting today, you can get .diff and .patch content directly from the API for the following resources:

Simply use the same resource URL and send either application/vnd.github.diff or application/vnd.github.patch in the Accept header:

curl -H "Accept: application/vnd.github.diff" $ https://api.github.com/repos/pengwynn/dotfiles/commits/aee60a4cd56fb4c6a50e60f17096fc40c0d4d72c

diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink
index 1f599cb..abaf625 100755
--- a/tmux/tmux.conf.symlink
+++ b/tmux/tmux.conf.symlink
@@ -111,6 +111,7 @@ set-option -g base-index 1
 ## enable mouse
 set-option -g mouse-select-pane on
 set-option -g mouse-select-window on
+set-option -g mouse-resize-pane on
 set-window-option -g mode-keys vi
 set-window-option -g mode-mouse on
 # set-window-option -g monitor-activity off

Pagination for Organization Repository lists now paginates properly

  • December 9, 2012
  • Avatar for rick rick


Improvements continue to the Organizations Repository listing endpoint. Today we're improving pagination so that it works as documented. Now you can expect Link headers to navigate through the results space, regardless of what you send in the type parameter.

The docs for Organization Repositories queries are still here:

EDIT: Link headers are our preferred navigation technique.

Finding sources and fork repositories for organizations

  • December 8, 2012
  • Avatar for rick rick

We've made a couple of changes today to the Organization repositories listing to bring it a bit closer to the functionality of the GitHub.com Organization repositories tab. We now let you retrieve repositories which are forks of another repository, as well as those repositories which are sources (not forks).

# Grab all fork Repositories for an Organization
curl "https://api.github.com/orgs/:org/repos?type=forks"

# Grab all source Repositories for an Organization
curl "https://api.github.com/orgs/:org/repos?type=sources"

Check out the docs for sorting and filtering options:

Create an OAuth authorization for an app

The Authorizations API is an easy way to create an OAuth authorization using Basic Auth. Just POST your desired scopes and optional note and you get a token back:

curl -u pengwynn -d '{"scopes": ["user", "gist"]}' \

This call creates a token for the authenticated user tied to a special "API" OAuth application.

We now support creating tokens for your own OAuth application by passing your twenty character client_id and forty character client_secret as found in the settings page for your OAuth application.

curl -u pengwynn -d '{ \
                     "scopes": ["user", "gist"], \
                     "client_id": "abcdeabcdeabcdeabcdeabcde" \
                     "client_secret": "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde" \
                    }' \ '

No more implementing the web flow just to get a token tied to your app's rate limit.

Per-repository Review and Issue Comment listing

You've always been able to grab all the commit comments for an entire repository via the API, but to get Issue comments and Pull Request Review Comments, you could only fetch the comments for a single Issue or Pull Request.

Today, we're introducing two new methods to grab all Issue Comments and Review Comments for a repository.

# Grab all Issue Comments
curl https://api.github.com/repos/mathiasbynens/dotfiles/issues/comments

# Grab all Review Comments
curl https://api.github.com/repos/mathiasbynens/dotfiles/pulls/comments

Check out the docs for sorting and filtering options:

Gitignore Templates API

We recently made it easy to initialize a repository when you create it via the API. One of the options you can pass when creating a repository is gitignore_template. This value is the name of one of the templates from the public GitHub .gitignore repository.

The Gitignore Templates API makes it easy to list those templates:

curl https://api.github.com/gitignore/templates

HTTP/1.1 200 OK


If you'd like to view the source, you can also fetch a single template.

curl -H 'Accept: application/vnd.github.raw' \

HTTP/1.1 200 OK

# Xcode

Forking to Organizations

We made a slight change to the way you fork a repository. By default, you can fork my repository through an HTTP POST to the repository's fork resource.

curl -X POST https://api.github.com/repos/technoweenie/faraday/forks

This repository forks to your personal account. However, there are cases when you want to fork to one of your organizations instead. The previous method required a ?org query parameter:

curl -X POST /repos/technoweenie/faraday/forks?org=mycompany

Query parameters on POST requests are unusual in APIs, and definitely inconsistent with the rest of the GitHub API. You should be able to post a JSON body like every other POST endpoint. Now, you can! Only, now we're calling the field organization.

curl /repos/technoweenie/faraday/forks?org=mycompany \
 -d '{"organization": "mycompany"}'

Don't worry, we are committed to maintaining the legacy behavior until the next major change of the GitHub API.