Git 1 - Getting Start Git and Common Usage

By Sheldon L Published at 2019-01-01 Updated at 2019-01-01


# user setting
git config --global user.name <username>
git config --global user.email <email@domain.com>

# DANGER. recover setting to zero
vim -r

# generate new key
ssh-keygen -t rsa -C your_email@domain.com  
# Press 'Enter' to save to defaul path
# Set Key: invisibal when input.
# If don't input anything, the key is null.
# It is recommended to set key as null.
# Confirm Key.

cat ~/.ssh/id_rsa.pub
# show existing SSH key
# start in local
git init
git add .
git commit -m '<somecomments>'

# then create an empy repo in github remotely, copy the command it gives you

git push
# remote is more updated than local
git push

# local is more updated than remote
git stash
git pull
git stash apply

# or follow the tips when went wrong
# local
git status

# DO
# create gh-pages branch in a github repo
git checkout origin/gh-pages

# OR
git checkout --orphan gh-pages

git status

git push --set-upstream gh-pages