github使用总结

参考:http://hi.baidu.com/mcspring/blog/item/171b1e38986d39fab211c71b.html

按照流程创建Repo,创建完以后会有如下界面:

Global setup:
 Set up git
  git config --global user.name "" //输入用户名
  git config --global user.email xxx@163.com
      
Next steps:
  mkdir TestRepo
  cd TestRepo
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:xwdreamer/TestRepo.git
  git push -u origin master
      
Existing Git Repo?
  cd existing_git_repo
  git remote add origin git@github.com:xwdreamer/TestRepo.git
  git push -u origin master
      
Importing a Subversion Repo?
  Click here
      
When you're done:
  Continue

执行完Next steps中的所有步骤,我们会在github上看到我们新建的TestRepo.git。

当我们再次想往项目里面创建文件是,我们这个时候使用

 git push -u origin master
来提交报错如下:

xxx@xxx ~/Hello-World (master)
$ git push -u origin master
To git@github.com:xxx/Hello-World.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xxx/Hello-World.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
根据提示我们先使用

git pull
再使用

git push











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值