Awesome
Automate GitHub Repository Initialization with Bash
This Bash script automates the process of creating a new GitHub repository, initializing it with a README file, and pushing the initial commit to the remote repository. The script prompts the user for a repository name and utilizes the GitHub API to create a new public repository.
Prerequisites
Before using this script, make sure you have the following:
- GitHub account
- GitHub username
- GitHub personal access token with repo scope
Installation Instructions (mkgit.bash)
Archlinux/Manjaro
yay -S mkgit
-
Clone the repository to your local machine:
git clone https://github.com/your-username/bash-github-repo-creator.git
-
Navigate to the cloned directory:
cd bash-github-repo-creator
-
Make the script executable:
chmod +x mkgit.bash
-
Execute the script
./mkgit.bash [-d] [-i] [-l] [-h]
###Flags
-d: Delete the configuration file and exit. -i: Initialize a Git repository in the current directory. -l: Prompt for license selection. -h: Display the help message.
Runing script without any flags makes new repo without licence at $HOME/Documents/Projects
-
The first time you use the script, it will prompt you to enter your GitHub credentials. These credentials will be saved in a configuration file for further use.
-
To run the script globally.
copy the script to
/usr/local/bin
you can create a alias
alias mkgit='mkgit.bash'
-
The script will create a new directory with the given repository name, initialize a Git repository, create an initial commit with a README file, and push it to the newly created GitHub repository.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. Make sure to follow the contribution guidelines.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.