git config --global [user.name](<http://user.name/>) "username"
git config --global user.email "[[email protected]](<mailto:[email protected]>)"
# check git config
git config --global --list
# checking if the key exist
ls ~/.ssh
# if not, generate the key
ssh-keygen -t rsa -C "[[email protected]](<mailto:[email protected]>)"
-t 指定密钥类型,默认是 rsa ,可以省略 -C 设置注释文字,比如邮箱
git config --global http.proxy http://<ip>:<port>
git init --initial-branch=main
or
git init -b main
git commit -a -m "Stylize the nav bar"
git push
# git push —set-upstream origin main
git push origin main
git commit —-amend —-no-edit
along with git push origin <branch_name> —-force
recover a file: git checkout -- <file_name>
Recover a file deleted by git rm
git reset HEAD index.html
git checkout -- index.html