# 生成
ssh-keygen -t ed25519 -C “[email protected]
# 设置
git config --global user.name "user"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main

# 在文件夹下
git init  # 初始化仓库

git add .  # 添加该路径下所有文件
git commit -m "first commit"  # 提交,m后是备注

git remote add origin https://github.com/szkm330/demo.git  # 连接,仓库名origin
git remote rm origin  # 删除连接
git remote -v # 查看

git branch -M main # 换名
git branch -a # 查看

git push -u origin main # 上传
git pull origin main

官网摘录

…or create a new repository on the command line

echo "# LrcToAss48" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/szkm330/LrcToAss48.git
git push -u origin main

…or push an existing repository from the command line

git remote add origin https://github.com/szkm330/LrcToAss48.git
git branch -M main
git push -u origin main