本地上传代码到github仓库
一、ssh远程连接
1.进入本地代码目录,打开git bash,输入:
ssh-****** -t rsa -c "[email protected]"
默认在/c/Users/Administrator/.ssh/id_rsa目录下生成以下文件
2.登入你的github账号,在Settings->SSH and GPG keys下new一个SSH key,将id_rsa.pub中的内容拷贝过来就行了,title自定义。
3.输入以下命令验证ssh是否生效
ssh -T [email protected]
二、同步本地和远程仓库代码
1.首先建立本地仓库
git init
2.关联本地仓库,仓库地址通过图示位置复制过来
git remote add origin https://你的仓库地址
3.同步github仓库
git pull origin master
三、上传更新代码
1.同步之后就可以开始上次更新了,.是包含目录下所以文件,也可以指定具体文件名。
git add .
2.提交信息可以换成你想要的指令
git commit -m "提交信息"
3.最后把本地仓库push到github上
git push -u origin master