-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
The gh repo create command does not take the current directory's name if a parent directory has a .git folder inside it.
For example
I am in /var/www/html/toplevel/wp-content/plugins/my_plugin.
The directory /var/www/html/toplevel has a .git folder inside it (which is pointing to a remote origin) as well as a .gitignore which, amongst others, ignores the wp-content/plugins directory.
I want to create a new repository for my_plugin inside the wp-content/plugins/my_plugin directory.
I run the gh repo create command inside wp-content/plugins/my_plugin and get the following:
? Repository name (toplevel)
I then fill out Repository name manually, so the entire command input and its output looked like this:
$ gh repo create
? Repository name my_plugin
? Repository description
? Visibility Public
? This will create 'toplevel' in your current directory. Continue? Yes
✓ Created repository tomekpryjma/toplevel on GitHub
fatal: remote origin already exists.
git: exit status 128
Version
$ gh --version
gh version 1.0.0 (2020-09-16)
https://github.com/cli/cli/releases/tag/v1.0.0
Steps to reproduce the behavior
git clone git@github.com:youruser/repository.git toplevel_directorycd toplevel_directory && echo nested_directory > .gitignoremkdir nested_directory && cd nested_directorygh repo create
Expected vs actual behavior
Expected behaviour
The gh repo create command takes the nested directory's name as the repository name and creates it in Git.
Actual behaviour
The gh repo create command takes the name of the parent directory that has a .git already initialised and uses that parent directory's name as the repository name and creates it in Git.
Logs
$ gh repo create
? Repository name my_plugin
? Repository description
? Visibility Public
? This will create 'toplevel' in your current directory. Continue? Yes
✓ Created repository tomekpryjma/toplevel on GitHub
fatal: remote origin already exists.
git: exit status 128