Git Support is Coming to the Laravel Installer

News

March 3rd, 2021

custom-artisan-commands.png

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:

1# Create a fresh Laravel app and `git init + commit`
2laravel new my-app.com --git
3 
4# Same as above, but also create a private GitHub repo
5laravel new my-app.com --github
6 
7# Same as above, but will commit Jetstream separately
8laravel new my-app.com --jet --github
9 
10# Pass some custom flags to the underlying `gh` command
11laravel new my-app.com --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.