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 [email protected]
      
Next steps:
  mkdir TestRepo
  cd TestRepo
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin [email protected]:xwdreamer/TestRepo.git
  git push -u origin master
      
Existing Git Repo?
  cd existing_git_repo
  git remote add origin [email protected]: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 [email protected]:xxx/Hello-World.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]: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











猜你喜欢

转载自blog.csdn.net/xw13106209/article/details/7074077