Skip to content

everton-dgn/script_to_create_and_delete_repositories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub

Script for creating and deleting GitHub repositories via command line

📝 About the Project

This project consists of a script to facilitate the creation and deletion of repositories on GitHub and locally on the PC.



📌 Contents



🚩 Features

  • 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 or ENTER 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.



✅ Prerequisites



❓ How to use and to set up the Project

Clone Repository

git clone https://github.com/everton-dgn/script_to_create_and_delete_repositories.git

Configuring the script

  • 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 then pwd 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 or delete_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.

Creating local and remote repository on GitHub


Image of script running in terminal



Image of script running in terminal



Image of script running in terminal



Image of script running in terminal



Deleting local and remote repository on GitHub


Image of script running in terminal



Image of script running in terminal



Image of script running in terminal



Customizing the local directory path

To customize the path of the directory where the local repositories are, change lines 336, 337 and 372 of the .functions_bash.sh file.

Customizing the available templates

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.


🧑‍💻 Author

By Éverton Toffanetto.

🔗 LinkedIn: https://www.linkedin.com/in/everton-toffanetto

🔗 YouTube: https://www.youtube.com/c/ProgramadordeSucesso

🔗 Site: https://programadordesucesso.com

About

This project consists of a script to facilitate the creation and deletion of repositories on GitHub and locally on the PC.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages