[置顶] github简单使用

git的介绍可以看这里   http://zh.wikipedia.org/wiki/GitHub

安装和使用参考的这个    http://www.cnblogs.com/cocowool/archive/2010/10/19/1855616.html

常用操作

为origin添加远程地址

 

$git remote add origin git@github.com:yourName/yourRepo.git

 

 

编辑好文件后就可以
  

 $git add filename


再提交到本地

    $git commit -m " "

-m的引号里加你的备注

 


提交到你的github上

    $git push origin master

 

自己遇到的错误

 

把origin连接到另外的远程地址

 

 $git remote add origin git@github.com:yourName/anotheryourRepo.git

会出现这样的错误

 

 

fatal: remote origin already exists


应该先把原来的origin删掉

 

 

$git remote rm origin

再重复先前的命令

 


当用下面命令提交时 

  $git push origin master

会出现

 

 

error:failed to push som refs to

 

 

可以现把文件来下来再提交

 

$git pull origin master

 

git中删除文件的命令是 git rm *

可以用git clone git@github.com:usename/res.git  把别人的代码clone下来
git上有很多的开源项目都可以clone下来看

我只是简单的将github用作代码备份的工具。


 

 

posted on 2013-08-25 21:00  you Richer  阅读(433)  评论(0编辑  收藏  举报