Force git to use HTTPS

Recently I encountered an issue where a CI tool could not fetch certain dependencies as the SSH key used for cloning the main project did not have access to the other repositories. To work around this, I opted to clone the private dependencies via https, passing the credentials in the URI. The magic to force this without changing composer.json: # Set the COMPOSER_USER and COMPOSER_TOKEN environment variables to a user which has access to clone these repos. git config --global url."https://${COMPOSER_USER}:${COMPOSER_TOKEN}@gitlab.example.com/".insteadOf "git@gitlab.example.com:" You can also clone public repos via the https endpoint rather than ssh like this: ...

April 28, 2020