- 新建目录,然后
git init
- 创建秘钥
ssh-keygen -t rsa -C "your_email@youremail.com"
- 去GitHub添加秘钥
cat ~/.ssh/id_rsa.pub
- 测试连接
ssh -T git@github.com
- 添加Git配置
$ git config --global user.name "your name" $ git config --global user.email "your_email@youremail.com"
- 本地
mkdir $name && git init
- 在github上创建仓库
- 添加远程地址
git remote add origin git@github.com:yourName/yourRepo.git
- 提交前先pull
git pull --allow-unrelated-histories
- 提交
$ git commit -m 'my project push'
$ git push origin master