git 常用命令

下载好 git 后的配置

1
2
3
4
5
6
7
8
9
10
# 配置全局用户和邮箱
git config --global user.name "shenjy"
git config --global user.email "asjdfasdfj@163.com"

# 生成公钥
ssh-keygen -t rsa -C 'asjdfasdfj@163.com'

# copy公钥
cd ~/.ssh
cat id_rsa.pub

创建新的仓库

1
2
3
4
5
6
7
echo "#shenjy.github.io" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/shenjy/shenjy.github.io.git
git push -u origin main

将已经存在的项目上传到 github

1
2
3
git remote add origin https://github.com/shenjy/shenjy.github.io.git
git branch -M main
git push -u origin main

完~