-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the feature or problem you’d like to solve
When running gh repo create as part of an automation the default gh_protocol is used to set up the remote. Therefor, any subsequent git call to the remote will be using the https protocol if it was the default. However, this causes any git call to invoke a usename/password prompt which can't be filled in by the user since they're not on-session due to it being an automation.
Proposed solution
I'd like to propose the addition of a --protocol flag which can be used as follows:
gh repo create --protocol sshThis way the more seamlessly ssh protocol is used to set up the remote which doesn't prompts the user and just uses an SSH key to authenticate. Of course, the user needs to have a SSH key set up with GitHub.
Additional context
What I'm actually trying to do is run these two commands as part of the automation to automatically set up a GitHub repository and push the main branch to it:
Part one initialises the git repo and commits the working directory
git init -q -b main .
git add .
git commit -q -m "Set up a fresh Laravel app"Part two creates the GitHub repository and pushes the main branch to GitHub
gh repo create my-app -y --private
git push -q -u origin mainIt's for the second part that I specifically need the remote to be added with the ssh protocol so the push is seamlessly and without any interruption. Note that I cannot make use of gh config set git_protocol ssh because I don't want to alter the user's protocol preference in the automation.
For full reference, this is the PR where I introduced the support for gh repo create with the Laravel installer: laravel/installer#185