Last active
March 11, 2019 06:21
-
-
Save kaskichandrakant/017e718f6f71267828d196fbbb95a0cf to your computer and use it in GitHub Desktop.
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 | |
if [ "$1" == "." ]; then | |
REPO_NAME=$(basename $PWD) | |
echo "creating $REPO_NAME repo on github" | |
git init . | |
curl -u "$(git config user.name)" https://api.github.com/user/repos -d '{"name":"'$REPO_NAME'"}' | |
elif [[ $# -gt 0 && "$1" != "-h" ]]; then | |
echo "creating $1 repo on github" | |
curl -u "$(git config user.name)" https://api.github.com/user/repos -d '{"name":"'$1'"}' | |
else | |
echo "Usage: gh_init [repo_name | . ] | |
. - To create repo with current directory name | |
repo_name - Creates repo with given name " | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment