git 上传下载版本迭代
2018-04-25 本文已影响0人
枣阳黄小明
前置知识,如何创建一个账号新建一个仓库, 这些都可以百度到
git ====== 生成秘钥
ssh-keygen -t rsa -C "1037428670@qq.com"
ps: 在电脑桌面空白处右键 git bash here 进入git 命令行 输入上面的命令行
image.png
》》第二步就是添加秘钥到github
复制生成的秘钥
![](https://img.haomeiwen.com/i7000961/4a536df8e07278df.png)
![](https://img.haomeiwen.com/i7000961/7f0cf5050433c233.png)
打开github仓库界面进入settings
![](https://img.haomeiwen.com/i7000961/cb5a5d5037873caa.png)
打开deploy keys
![](https://img.haomeiwen.com/i7000961/bccfb145421f227b.png)
添加秘钥
![](https://img.haomeiwen.com/i7000961/5246ba19a813d702.png)
将复制的秘钥粘贴这里就可以了
![](https://img.haomeiwen.com/i7000961/b83d848a46674434.png)
成功后就是这样的
![](https://img.haomeiwen.com/i7000961/0af37761df8eab61.png)
接下来就是clone 和提交
回到git命令行 git bash here 输入以下指令验证是否成功
ssh -T git@github.com
显示以下图片则表明验证成功
image.png
接下来是利用git命令上传代码
1.在PC桌面空白处点击右键 》git bash here
2.复制github仓库的clone地址
![](https://img.haomeiwen.com/i7000961/3b41650812f1b57b.png)
3.在命令行输入 git clone git@github.com:zhangpengfei1990/safeProduct.git
(注意复制的网址只要后面的一部分)
![](https://img.haomeiwen.com/i7000961/a9fd338a493d4011.png)
4.接下来你的电脑桌面就完整的将项目clone到了本地,修改一些文件,保存后利用git命令行上传上去(下图为新建的文件)
![](https://img.haomeiwen.com/i7000961/f44b65b465e1851e.png)
5.>> 命令行
》git pull 检查线上仓库版本是否变更 下载
》git add . 添加
》git commit -m "new html" 新增文件描述
》git push 提交