感谢这个哥们的博客,不过里面有些错误。

http://www.cnblogs.com/ruofengzhishang/p/3842587.html

下面是我自己的实践成功的:

这篇文章写得是windows下的使用方法。

第一步:创建Github新账户

第二步:新建仓库

第三部:填写名称,简介(可选),勾选Initialize this repository with a README选项,这是自动创建REAMDE.md文件,省的你再创建。

第四步:安装Github shell程序,地址:http://windows.github.com/

也可以在这里下载git for windows

http://rj.baidu.com/soft/detail/30195.html?ald

2.

第五步:打开Git Shell,输入以下命令生成密钥来验证身份

ssh-keygen -C your@email.address -t rsa

连续三个回车之后会在windows当前用户目录下生成.ssh文件夹,和linux一样。

把文件夹下的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 到本地,输入命令:

 git clone https://github.com/Flowerowl/stumansys.git

这时会在目录下生成:(注意如果你的仓库名是Test,那么会生成c:/user/Test)

第八步:将想上传的代码目录拷贝到此文件夹下:

有可能还需要加上这一段

第九步:切换到Git shell 命令行下,输入命令:

git init

git config –global user.email “1455971532@qq.com”

git config –global user.name “caoxinyu”

git commit -m ‘hellow’

git remote rm origin

git remote add origin https://github.com/androidBsat/Test.git

git push origin master

一切参数自己替换。 执行这一步的时候,把目录切换到test目录下。

hellow是描述信息。



如果是以后添加,那么commit之前git add ./*一下,添加到缓冲区。

git init

git add ./*

git commit -m ‘hellow’

git remote rm origin

git remote add origin https://github.com/androidBsat/Test.git

git push origin master

git commit -m 后面是你更改的信息

每次更改把这上面的一段复制,改改就行了。

删除

git init

git rm ./yuge/*

git commit -m ‘nothing’

git remote rm origin

git remote add origin https://github.com/androidBsat/Test.git

git push origin master

改 改就是你添加就行了

git init

git add ./hellow.txt

git commit -m ‘nothing’

git remote rm origin

git remote add origin https://github.com/androidBsat/Test.git

git push origin master

下面的可以不看,直接用我写好的,避免各种错误。

git init

git commit -m ‘stumansys’

git remote add origin https://github.com/Flowerowl/stumansys.git

git push origin master

如果执行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 上去。

最后,你可以去项目页面查看了~~代码上传成功!

有问题可以在下方留言,大家一起解决~

git上传自己的代码的更多相关文章

  1. 更加方便的使用git上传自己的代码

    经过以上的培训,同学们肯定对git的基本使用没有什么问题了.但是每次代码有更改后,依旧需要 git  add  * git  commit * git   打开vim编辑器,编辑提交信息 或者 git ...

  2. 使用Git上传本地项目代码到github

    前提:(1)ssh密钥(让本地与git链接) &  (2)装好gitbash 1.git中创建好库 2.文件夹中输入:git init (出现隐藏的.git文件) 3.git remote a ...

  3. git上传项目代码到github

    参考: git学习——上传项目代码到github github上传时出现error: src refspec master does not match any解决办法 git 上传本地文件到gith ...

  4. JAE京东云引擎Git上传管理代码教程和京东云数据库导入导出管理

    文章目录 Git管理准备工作 Git工具上传代码 发布代码装程序 mywebsql管理 京东云引擎小结   JAE京东云引擎是京东推出的支持Java.Ruby.Python.PHP.Node.js多语 ...

  5. git上传代码到github

    git上传代码到github [root@bigdata-hadoop- ~]# git init [root@bigdata-hadoop- ~]# git add zeppelin [root@b ...

  6. 用git上传代码到新浪云

    新浪云空间是国内免费的一个空间,不过有限制很多. 申请新浪云需要新浪账号,注册略. 使用新浪账号去http://sae.sina.com.cn申请一个空间 选择新建应用 可以选择使用php项目 管理应 ...

  7. 怎样用git上传代码到github以及如何更新代码

    上传代码: 1.进入指定文件夹: cd 指定文件夹 2.初始化git仓库: git init 3.将项目所有文件添加到暂存区: git add . 4.提交到仓库: git commit -m &qu ...

  8. Ubuntu 中使用git 上传代码

    现在很多人都愿意把自己的代码分享给大家,所以有很多的代码管理的软件 ,比如SVN Git 等软件.今天就讲一下  git 的简单的应用,上传代码.用 git 上传代码 要有个git 账号,这是必不少的 ...

  9. git上传布置代码 git优势

    ftp 软件 可直接上传至服务器但不便于管理 Git上传 GitHub/码云/codinghub 登录服务器 ssh 协议登录 ssh 账户@ip地址 密码 mkdir 创建文件 workspace ...

随机推荐

  1. 一、Spring-Data-Jpa 初体验(基于SpringBoot)

    闲话少说,首先动起来(基于springboot+gradle): 1.引入依赖 dependencies { compile 'org.springframework.boot:spring-boot ...

  2. Sublime常用插件安装大全

    作为前端人员,要找一个很顺手的编辑器真的不容易,我向大家推荐的一款实用前端开发神器,不但占地小,且插件很多,很强大. 下面我向大家介绍一下它的安装及插件的使用方法. 一.安装及安装emmet插件 首先 ...

  3. mockJs语法糖用例

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  4. intellij idea中设置SVN插件教程

    1.选择VCS→Browser VCS Repository→Browse Subversion Repository 2.在弹出的SVN Repository菜单中,选择左上角的绿色“+”号,填写S ...

  5. HDU 3351 Seinfeld 宋飞正传(水)

    题意: 给出一个串,串内只有大括号,问经过几次改变可使全部括号合法?改变指的是可以将某一方向的括号变成另一方向. 思路: 利用栈的特点,若出现成对的合法括号,直接删掉,留下那些不合法的成为一串.既然不 ...

  6. php:生成的时间与本地电脑的时间不匹配

    如题,在php中我发现在数据库中的时间跟电脑上的时间没有同步 本地时间: 数据库中,生成的时间: 很明显,时分秒是对应不上去的,那么我们只要在php.ini中找到 这里被注释掉了,那我们就改成这样: ...

  7. js基础笔录

    1.页面中获取对象 document.getElementById("demo") 2.在页面加载时向 HTML 的 <body> 写文本 document.write ...

  8. thinkphp 去掉URL 里面的index.php(?s=)

    例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/g ...

  9. Miller-Rabbin 素性测试 和 Pollard_rho整数分解

    今天学习一下Miller-Rabbin  素性测试 和 Pollard_rho整数分解. 两者都是概率算法. Miller_Rabbin素性测试是对简单伪素数pseudoprime测试的改进. (ps ...

  10. Problem A: C语言习题 链表建立,插入,删除,输出

    #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct student { l ...