Create GitHub Repository from MacOS with Homebrew
1 min readJan 29, 2022
- Open Terminal, Install Homebrew package from ~ directory :
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
then, continue with these command below.
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
Visit https://docs.brew.sh/Installation (Untar Anywhre)
2. Back to ~ directory -> open .zshrc file with vim :
cd ~
vim .zshrc
Paste this PATH inside.zshrc file :
PATH=~/homebrew/bin:$PATH
Then Press ESC, type :wq.
3. Install gh CLI from github with your homebrew:
brew install gh
4. Create your repository (login first)
gh auth login => gh repo create
Choose your best way. For me, i use personal access token.
5. Upload your project to repository ;
Open your project directory, then type these command below in terminal
git init -b main
git add .
git commit -m "your message"
git branch -M main
git remote add origin https://github.com/yourusername/yourprojectname.git
git push -u origin main