Generate new ssh keygen

git config --global [user.name](<http://user.name/>) "username"
git config --global user.email "[[email protected]](<mailto:[email protected]>)"
// checking if the key exist
cd ~/.ssh
ls
ssh-keygen -t rsa -C "[[email protected]](<mailto:[email protected]>)"

-t 指定密钥类型,默认是 rsa ,可以省略 -C 设置注释文字,比如邮箱

add proxy

git config --global http.proxy http://<ip>:<port>

Init git repository

git init --initial-branch=main or git init -b main

Git Commit

git commit -a -m "Stylize the nav bar"
git push
# git push —set-upstream origin main
git push origin main

Modify the latest commit

git commit —-amend —-no-edit

along with git push origin <branch_name> —-force

Recover deleted files

recover a file: git checkout -- <file_name>

Recover a file deleted by git rm git reset HEAD index.html git checkout -- index.html