Skip to content

Instantly share code, notes, and snippets.

@Geek-ubaid
Last active June 27, 2020 12:45
Show Gist options
  • Save Geek-ubaid/87995c4ed460471fedff9a5d087ea9eb to your computer and use it in GitHub Desktop.
Save Geek-ubaid/87995c4ed460471fedff9a5d087ea9eb to your computer and use it in GitHub Desktop.
Shell script for automation of creation of github repository
CURRENTDIR=${pwd}
echo "What name do you want to give your remote repo?"
read REPO_NAME
echo "Enter a repo description: "
read DESCRIPTION
echo "what is the absolute path to your local project directory?"
read PROJECT_PATH
echo "What is your github username?"
read USERNAME
echo $PROJECT_PATH
cd "$PROJECT_PATH"
git init
touch README.MD
git add README.MD
git commit -m 'initial commit -setup with .sh script'
curl -u ${USERNAME} https://api.github.com/user/repos -d "{\"name\": \"${REPO_NAME}\", \"description\": \"${DESCRIPTION}\"}"
git remote add origin https://github.com/${USERNAME}/${REPO_NAME}.git
git push --set-upstream origin master
cd "$PROJECT_PATH"
echo "Done. Go to https://github.com/$USERNAME/$REPO_NAME to see."
echo " *** You're now in your project root. ***"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment