Git Support is Coming to the Laravel Installer


March 3rd, 2021


The Laravel installer is getting a new feature that allows you to immediately set up a Git repository with a fresh Laravel app, and even push it to GitHub:

Here are some examples of what the new install options will look like (taken from the PR description) once this feature is available:

# Create a fresh Laravel app and `git init + commit`
laravel new --git

# Same as above, but also create a private GitHub repo
laravel new --github

# Same as above, but will commit Jetstream separately
laravel new --jet --github

# Pass some custom flags to the underlying `gh` command
laravel new --github="--public --team laravel"

As you can see above, the installer uses the GitHub CLI to create a private GitHub repository based on your configuration settings. You'll need to set up the gh CLI first to use the --github flag.

At the time of writing, this feature is still under review but should be available soon. You can follow along and see the source code behind this feature in laravel/installer PR #185. A massive shout-out to Dries Vints for submitting this feature request!

Also, check out our article about updating the Laravel installer to stay up-to-date with the latest installer features.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.