GitHub上传代码
来源:互联网 发布:淘宝围巾专卖店有哪些 编辑:程序博客网 时间:2024/04/28 10:48
第一步:创建Github新账户
第二步:新建仓库
第三部:填写名称,简介(可选),勾选Initialize this repository with a README选项,这是自动创建REAMDE.md文件,省的你再创建。
第四步:安装Github shell程序,地址:http://windows.github.com/(这个网址上下载速度太慢,可以去网上找其他资源)
第五步:打开Git Shell,输入以下命令生成密钥来验证身份
ssh-keygen -C 'your@email.address' -t rsa
your@email.address是你自己的邮箱
连续三个回车之后会在windows当前用户目录下生成.ssh文件夹,和linux一样。
默认生成在C:\Users\lujiandong\.ssh(即用户文件夹下面)
把文件夹下的id_rsa.pub文件内容全部复制。
然后打开github账户设置,如图
打开ssh keys
右上角点击add ssh key
然后在title随便输入,key栏粘贴刚才的密钥。
第六步:在Git Shell下输入命令测试刚才的公钥是否认证正确。
ssh -T git@github.com
正确结果会显示:
Warning:Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. Hi Flowerowl! You've successfully authenticated, but GitHub does not provide shell access.
warning 不用理会。
第七步:clone刚才新建的repository 到本地,输入命令
这时会在目录下生成:
即本地仓库的默认的目录是:C:\Users\lujiandong\12344
然后将你想上传的代码放到这个文件夹,即本地仓库中。
上传本地仓库到远程服务器的步骤如下:
第一步:先引导到本地仓库即,文件夹12344中(在本例中)
命令 ls 可以查看当前目录的文件。
很明显,当前路径并不是在文件夹12344,所以需要用cd引导
明显,现在的路径是到了文件夹12344,用命令ls可以查看出我们添加到里面的cpp,.h文件
接下来的步骤:
1、
必须用git add .全选所有文件
2、
commit命令加注释
3、
如果执行git remote add origin
https://github.com/Flowerowl/stumansys.git
,出现错误:
fatal: remote origin already exists
则执行以下语句:
git remote rm origin
再往后执行git remote add origin https://github.com/Flowerowl/stumansys.git 即可。
在执行git push origin master时,报错:
error:failed to push som refs to.......
则执行以下语句:
git pull origin master
先把远程服务器github上面的文件拉先来,再push 上去。
4、
到此就实现代码的上传。
- github上传代码
- github上传代码
- Github上传代码
- Github 上传代码
- GitHub上传代码
- 上传代码至Github
- 上传代码到github
- 使用github上传代码
- github上传代码
- github上传代码
- GitHub上传代码教程
- github上传代码
- Github 上传代码
- github上传代码
- 上传代码到Github
- gitHub上传本地代码
- 上传代码到github
- Github上传代码
- 55555555555
- 华为机试—根据各个位的和排序
- 没机会广泛的广泛的
- 使用爱查快递接口
- ubuntu 14.04 安装深度音乐
- GitHub上传代码
- Visual Studio 2013 Find in Files 无法显示搜索结果
- 判断一个对象是否遵循协议
- 华为机试—数字逆序且求个位数乘积
- Linux使用nc命令监控检测服务器端口
- 编程题(2)------购物计划(不定方程的应用)(C)
- 查询oracle表的信息
- 华为机试—字符串删除数字大写变小写
- hah