This project consists of a script to facilitate the creation and deletion of repositories on GitHub and locally on the PC.
-
Create local and GitHub repositories with the desired name;
-
Offers option to create public or private repository;
-
Allows you to create the empty repository or from some template;
-
After creating the repositories, close the terminal after 20 seconds or just enter the folder of the local repository created, if the
ESC
orENTER
key is pressed; -
Deletes without confirmation any local repository, any remote repository on GitHub, or both simultaneously.
-
After creating the repository, it opens the project folder in Visual Studio Code automatically.
-
For Windows, Git Bash or WSL;
-
For Linux or Mac, terminal in Shell Script.
git clone https://github.com/everton-dgn/script_to_create_and_delete_repositories.git
- Copy the
functions_bash.sh
file and paste it in any folder. - In the example the file was copied and pasted in the user folder.
- To find the user's folder use the command
cd
to enter it and thenpwd
to show the path of the current directory. - Locate the Bash configuration file in the user folder.
.bash_profile
(if using Windows) or.bashrc
(if using Linux or Mac).- In the Bash configuration file, first of all import the
functions_bash.sh
file. - Importing the
functions_bash.sh
file looks like this if the file is in the user's folder:source ~/.functions_bash.sh
- Reopen the Bash terminal and run the command
create_repository
ordelete_repository
. - Note: If you are using the zsh terminal, the settings must still be made in the .bashrc file and to trigger the script you need to run in the terminal:
bash
. Only then use the script commands in the terminal.
To customize the path of the directory where the local repositories are, change lines 336, 337 and 372 of the .functions_bash.sh
file.
On line 311, inside the options
array, you can pass the names of the templates (GitHub repositories marked as templates) that you want to use when creating a repository.
On line 321, change the conditional block that refers to each position in the options
array.
Inside the conditional blocks, in the use_template
variable you must insert, after the --template
property, the exact name of the template (which corresponds to the name of the template repository on GitHub).
For the first position of the array (key 0) it was chosen to leave the option None.
, so that if selected, the variable use_template
will have an empty string value and thus, no template will be added when creating the repository, leaving it completely empty.
🔗 LinkedIn: https://www.linkedin.com/in/everton-toffanetto
🔗 YouTube: https://www.youtube.com/c/ProgramadordeSucesso
🔗 Site: https://programadordesucesso.com