install github CLI on osx
brew install gh
brew upgrade gh
gh auth login --web
# for headless:
# gh auth login --with-token
# echo "token" | gh auth login --with-tokenhttps://cli.github.com/manual/installation
install github CLI on linux ubuntu
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
set github tokens to login to github via cli
https://github.com/settings/tokens/new
create local git repo and github project
# change to your github account username:
GH_USER="changeme-github-account-username"
# set current dirname as project name
GH_NAME=`basename "\`pwd\`"`
touch README.md
git init
git add .
# Adds the files in the local rep and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
git commit -m "init"
# create a repository under your account using the current directory name
gh repo create $GH_NAME --private
#wait a while
sleep 2
git branch -M main
git push -u origin main
echo https://github.com/$GH_USER/$GH_NAMEcreate local repo
git init
git add .
# Adds the files in the local rep and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
git commit -m "init"add remote to github
git remote add origin <REMOTE_URL>
# Sets the new remote
git remote -v
# Verifies the new remote URLpush to github
$ git push -u origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origincreate git repo and add to existing github project
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:username/reponame.git
git push -u origin master