#!/bin/bash
# Set your GitHub username and email
# 레포지토리 이름을 설정하는 부분입니다.
# 여기서는 명령어를 실행한 디렉토리 이름을 레포지토리 이름으로 씁니다.
# 만약 규칙을 원하신다면 편의에 맞게 바꾸시면 될 것 같아요.
repo_name=$1
dir_name=`basename $(pwd)`
if [ "$repo_name" = "" ]; then
repo_name=$dir_name
fi
# 깃헙 계정 정보를 넣어주세요.
export GITHUB_USERNAME="깃허브유저이름"
export GITHUB_EMAIL="깃허브이메일"
git config --global user.name "${GITHUB_USERNAME}"
git config --global user.email "${GITHUB_EMAIL}"
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
echo "MAKE REPO IN GITHUB"
curl -u "${GITHUB_USERNAME}" https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}"
echo "[Info] Creating Local Git Repository ...."
git init
git add .
# 디폴트로 'Init'이 커밋 메세지로 들어가게 했어요.
# 이 부분 또한 편의에 맞게 바꿔 주시면 됩니다!
git commit -m "Init"
git remote add origin https://github.com/${GITHUB_USERNAME}/$repo_name.git
echo "[Info] Pushing local repository master branch to Github origin/master branch..."
git push -u origin master