Skip to content

Instantly share code, notes, and snippets.

@aimfireready
Last active March 10, 2026 04:09
Show Gist options
  • Select an option

  • Save aimfireready/e816f5b143ddbd854accc32d0c0a3bd0 to your computer and use it in GitHub Desktop.

Select an option

Save aimfireready/e816f5b143ddbd854accc32d0c0a3bd0 to your computer and use it in GitHub Desktop.
Initialize a new Git project and corresponding Github repo
#! /bin/bash
###########################################################
# ************************
# ** **
# ** Init Though **
# ** **
# ************************
#
# Requirements
# - Git installed and configured
# - Github CLI
#
# Usage
# -----------------------
# Param 1 = Repo name
# Param 2 = Privacy setting: public, private, or internal
#
###########################################################
# if [ $# -eq 0 ]; then
# >&2 echo "No arguments provided."
# echo "Include the reponame (req) and the privacy setting (opt)."
# echo "Example: "
# echo "init-though.sh awesome-acme-accelator (defaults to a private repo)"
# echo "or"
# echo "init-though.sh explosive-space-modulator public"
# exit 1
# fi
cd ~/code
# Set parameters to named variables
read -p "Enter Repo Name: " reponame
read -p "Enter Language: " lang
langLowercase="${lang,,}"
# XX read -p "Enter repo privacy level: " privacy
# Set default to create a private repo
privacy='private'
# Create a new React project
if [ $langLowercase == "react" ]
then
echo "Creating React app. Please wait..."
npx create-react-app $reponame && cd $reponame
elif [ $langLowercase == "php" ]
then
echo "Creating PHP app. Please wait..."
# composer init
composer create-project laravel/laravel $reponame && cd $reponame
else
echo "WARNING: No suitable language provided. Exiting..."
exit 1
fi
mkdir -p $reponame && cd $reponame
## ../fixkey.sh
eval $(ssh-agent -s) && ssh-add ~/.ssh/*
# Create a new repo in GitHub
echo "Creating new Github repo '$reponame'"
### gh repo create $reponame --$privacy
# Create a new Git project
git init $reponame .
echo "One small byte for man..." >> README.md
git add README.md
git commit -m "Init though..."
git remote add origin git@github.com:aimfireready/$reponame.git
### git push -u origin master
########################################
# Version History
# 2023-05-04
# 2023-05-15 Added PHP/Laravel and removed argument validator
@aimfireready

Copy link
Copy Markdown
Author

Update cd command to *nix ~ home dir instead of Win Git Bash /c dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment