首次使用
在github上配置密钥、创建仓库
cd ~/.ssh
,查看是否有id_rsa
和id_rsa.pub
文件
如果没有,使用ssh-keygen -t rsa -C "username@email"
进行密钥生成。
将id_ras.pub
拷贝到github的setting/SSH and GPG keys
中
将服务器目录变成可托管形式
- 进入待上传目录
git init
git add <file1> <file2> <dir1> ...
git status
git config --global user.email "username@email"
git config --global user.name "github username"
git commit -m "commit message"
git remote add origin git@github.com:xxxxxx.git
git remote set-url origin git@github.com:xxxxxx.git
10.git push origin master
非首次使用
git add <file1> <file2> <dir1> ...
git status
git commit -m "commit message"
git push