Git push 总结

来源:互联网 发布:雅马哈授权网络经销商 编辑:程序博客网 时间:2024/05/20 02:22

git向远程仓库提交时:

<span style="font-family:Comic Sans MS;">git remote add origin https://github.com/xxxxxxx/LearnMore.gitgit push -u origin master</span>

断开远程仓库连接 

<span style="font-family:Comic Sans MS;">git remote rm origin</span>

当向远程仓库更新文件时需要

<span style="font-family:Comic Sans MS;">git fetch origin git merge origin/mastergit push -u origin master(第一次提交时这样,后面的提交就直接写git push origin master)</span>

否则会报错

<span style="color:#cc0000;"><strong>failed to push some refs to 'https://github.com/xxxxxxx/LearnMore.git'</strong></span>hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Merge the remote changes (e.g. 'git pull')hint: before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.</span>


0 0