Composer and Git on Windows
I’ve been having some problems downloading packages using Composer. It seems GitHub is having some hickups and it’s returning errors such as:
[Composer\Downloader\TransportException]
The "http://nodeload.github.com/symfony/Yaml/zipball/v2.1.3" file could not be downloaded (HTTP/1.1 404 Not Found)
As a workaround you can use the --prefer-source
flag to tell Composer to download the source code rather than using a bundled package. However, this means that you must have Git on your path, otherwise composer won’t be able to find it.
When I installed git, I chose the option to use the git shell, and as a result it didn’t put it on my path. I could put the cmd folder in the git installation location on the path, but instead of polluting my path, I decided to modify the composer.bat file to set the path to git.
@ECHO OFF
rem Include GIT on the path
SET PATH=%PATH%;C:\Program Files (x86)\Git\cmd
SET composerScript=composer.phar
php "%~dp0%composerScript%" %*
On Windows 7, if you used the composer installer, composer.bat should be in C:\ProgramData\Composer\bin. Make sure you change the path to git to reflect your environment.