1. windows 下需要安装git

1)github 上创建仓库
2)Clone with ssh
3)git@github.com:abc123456/VNotedata.git

#本地上创建需同步的文件夹

1.1. 生成公钥

在.ssh文件夹下使用git bash here
ssh-keygen -t rsa -C "qwe123@163.com"  -f ~/.ssh/github-rsa
github-rsa:生成公钥私钥对的文件名称
~/.ssh/表示生成的路径,windows下指向C:\Users\Administrator,Administrator表示当前的用户名

2. 在.ssh目录下创建一个名字是config的文件

#github
Host github.com
User qwe123@163.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github-rsa

2.1. 在GitHub 上设置公钥

Settings——>SSH and GPG keys——>New ssh key
key在github-rsa.pub文件中

3. 测试是否能够连接:

ssh -T git@github.com

4. 同步&提交

git clone  git clone git@github.com:abc123456/VNotedata.git

4.1. 回到.git目录下

同步
    git pull #拉取,同步更新github上的内容
    git status #查看暂存区状态
 提交
    git status
    git add *   #git add [参数][--] <路径>  //作用就是将我们需要提交的代码从工作区添加到暂存区,就是告诉git系统,我们要提交哪些文件,之后就可以使用git commit命令进行提交了。
    git commit -m "linux 提交更改" #更新到本地仓库
    git push #推送上传到github
posted on 2020-11-03 02:30  花易暖  阅读(648)  评论(0)    收藏  举报