Administrator@VAIO-11061700 /d/GitHub/RescueApp (master)
$ git push origin master
To git@github.com:jptiancai/RescueApp.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:jptiancai/RescueApp.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Administrator@VAIO-11061700 /d/GitHub/RescueApp (master)
$ git push -f
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 92, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (81/81), done.
Writing objects: 100% (92/92), 2.20 MiB | 966.00 KiB/s, done.
Total 92 (delta 12), reused 0 (delta 0)
To git@github.com:jptiancai/RescueApp.git
+ be58463...926da3f master -> master (forced update)
Administrator@VAIO-11061700 /d/GitHub/RescueApp (master)
$
---------------------------------------------------后续更新--------------------------------------------------
时隔多日,再次用到git这个神级的版本管理工具的时候,上面的代码依然有用,在这里稍微总结一下,方便以后查看:
创建个人项目到github上或者fork别人的项目配置用户名、密码、私钥--->和github取得连接,如需要设置代理上网,请看这篇:在公司的局域网使用git或github 设置代理[1]
添加本地文件到github代码库中---> inti,add,remote add, commit,push,遇到master整合到master的时候,可以用 -f,强制merge
git clone github地址,可参照下图直接复制粘贴。
GitHub Guides[2]:目前教学文章较少,仅仅9篇,但是篇篇都很经典,从HelloWorld开始看,你一定会有收获。
Git官网[3]:网站十分友好,提供了在线TryGit学习方式,文档,视频,软件,一应俱全。
Git cheatsheet[4]:里面有大部分的命令,很实用!
提交你自己的代码,参考Pushing to a remote[1]fork你喜欢的库
git branch new_branch
git checkout new_branch
一系列操作(git add......)
git push origin new_branch
----------------
之后刷新官网会有所显示,提交上去,等待使用者审核通过
提交自己的代码,同步最新的代码,参考[2],[3]merge到自己项目的master上,提交后就看原作者的审核了
git checkout master--->以master的身份运行
git merge new_branch
git diff new_branch master
git status