diff options
| author | Rishi Krishna <56212396+Rishi-k-s@users.noreply.github.com> | 2025-01-29 12:56:22 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-29 12:56:22 +0530 |
| commit | ee11f5d4d943643cd42a6d78e04095bb6cf65041 (patch) | |
| tree | 941eaffe57a7bd6081a5f43cc04800983e671e2e | |
| parent | 4f0937d016484406a2a0edc791056fb4d05f2b76 (diff) | |
| parent | 8d02e6cfc8cd1bbed6e1713a4fe03f6612b5193a (diff) | |
Merge pull request #1 from Pseudozoid/feature/bash-support
Added Linux Support
| -rw-r--r-- | README.md | 22 | ||||
| -rw-r--r-- | gitsetup.sh | 29 |
2 files changed, 48 insertions, 3 deletions
@@ -21,11 +21,11 @@ This repository contains a batch file that automates various GitHub processes to ``` - Configure your GitHub credentials for seamless authentication. -## Usage (Windows) -**Support for more OS will be added ;)** +## Usage +### Windows 1. Clone this repository to your local machine. -2. move the repo directory to `C:\aliases` +2. Move the repo directory to `C:\aliases` 3. Edit the `origin` section in the batch file to set your GitHub username and email: ```bat git remote add origin https://github.com/your_user_name/%1 @@ -37,6 +37,22 @@ This repository contains a batch file that automates various GitHub processes to ``` 6. Done ✨ +### Linux +1. Clone this repository to your local machine. +2. cd into the cloned repo +3. Edit gitsetup.sh and replace github_username with your username in + ```bash + git remote add origin git@github.com:github_username/"$REPO_NAME".git + ``` +4. Run `chmod +x gitsetup.sh` +5. Copy the gitsetup.sh script to your desired location, preferrably to the one where you keep all your scripts +6. Add `export PATH=$PATH:/path/to/script` to your `~/.bashrc` file if the location is not alredy part of your PATH +7. Run `source ~/.bashrc` +8. Now you can run the script from any location where you want to initialize a new github repository using + ```bash + gitsetup.sh <repo-name> <commit-message> [--private|--public] + ``` + ## Example ``` gitsetup test "first commit" --private diff --git a/gitsetup.sh b/gitsetup.sh new file mode 100644 index 0000000..5089257 --- /dev/null +++ b/gitsetup.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Usage: ./gitsetup.sh <repo-name> <commit-message> [--private|--public] +if [ "$#" -lt 2 ]; then + echo "Usage: $0 <repo-name> <commit-message> [--private|--public]" + exit 1 +fi + +REPO_NAME=$1 +COMMIT_MSG=$2 +VISIBILITY=${3:-"--private"} + +git init +git add . +git commit -m "$COMMIT_MSG" + +if [ "$VISIBILITY" == "--private" ]; then + gh repo create "$REPO_NAME" --private +elif [ "$VISIBILITY" == "--public" ]; then + gh repo create "$REPO_NAME" --public +else + echo "Invalid visibility option. Use --private or --public." + exit 1 +fi + +# Change github_username to your github username below +git remote add origin git@github.com:github_username/"$REPO_NAME".git +git push -u origin main + |
