Last active
May 23, 2019 15:18
-
-
Save leo-bianchi/fa92f74803261425a32261640bd825e7 to your computer and use it in GitHub Desktop.
Consuming Github API to create remote REPO #bash #github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a remote repository using github API | |
read -p "Type the repo name, and press [ENTER]:" repo_name | |
read -p "Type repo description, and press [ENTER]:" repo_desc | |
printf "REPOSITORY NAME: $repo_name\nREPOSITORY DESCRIPTION: $repo_desc\n" | |
# Confirmation | |
while true; do | |
read -p "Do you wish to create the repo?(y/n)" yn | |
case $yn in | |
[Yy]* ) curl -u 'username' https://api.github.com/user/repos -d '{"name":"'"$repo_name"'", "description":"'"$repo_desc"'"}' | |
[Nn]* ) exit;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment