diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 5fc1df471..0b5a32294 100755 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -108,7 +108,14 @@ class GitHubDriver extends VcsDriver return $this->gitDriver->getDist($identifier); } $label = array_search($identifier, $this->getTags()) ?: $identifier; - $url = 'https://github.com/'.$this->owner.'/'.$this->repository.'/archive/'.$label.'.zip'; + + if ($this->isPrivate) { + // Private GitHub repository zipballs are accessed through the API. + // http://developer.github.com/v3/repos/contents/#get-archive-link + $url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$label; + } else { + $url = 'https://github.com/'.$this->owner.'/'.$this->repository.'/archive/'.$label.'.zip'; + } return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => ''); }