Github上传代码菜鸟超详细教程【转】
最近需要将课设代码上传到Github上,之前只是用来fork别人的代码。
这篇文章写得是windows下的使用方法。
第一步:创建Github新账户
第二步:新建仓库
第三部:填写名称,简介(可选),勾选Initialize this repository with a README选项,这是自动创建REAMDE.md文件,省的你再创建
第四步:安装Github shell程序,
第五步:打开Git Shell,输入以下命令生成密钥来验证身份
ssh-keygen -C 'your@email.address' -t rsa
cat ~/.ssh/id_rsa.pub
把文件夹下的id_rsa.pub文件内容全部复制。
然后打开github账户设置,如图
打开ssh keys
https://github.com/settings/ssh。
第六步:在Git Shell下输入命令测试刚才的公钥是否认证正确。
ssh -T git@github.com
正确结果会显示:
第七步:clone刚才新建的repository 到本地,输入命令:
https://github.com/paohaijiao/storm.git
git config --global http.sslVerify false
[root@localhost code]# git clone https://github.com/paohaijiao/storm.git
这时会在目录下生成:描述性文件
第八步:将想上传的代码目录拷贝到此文件夹下:
第九步:切换到Git shell 命令行下,输入命令:
[root@localhost storm]# git add README.md
[root@localhost storm]# git commit -m "first commit"
[master 9bacb7b] first commit
1 file changed, 1 insertion(+)
create mode 100644 README.md
[root@localhost storm]# git remote add origin https://github.com/paohaijiao/storm.git
fatal: remote origin already exists.
[root@localhost storm]# git remote rm origin
[root@localhost storm]# git remote add origin https://github.com/paohaijiao/storm.git
[root@localhost storm]# git push -u origin master