github - git push -u origin 一直提示 git pull

【字号: 日期:2023-10-24浏览:31作者:雯心

问题描述

原先已经提交过git,后来把 .git 文件夹删除了。现在重新提交

git push -u origin master

一直提交不了!git pull 了很多遍也是一样。

Administrator@PC-20140703LOZL /D/PC/pc_ppgame (master)$ git status n branch masternothing to commit, working directory clean/D/PC/game (master)git push -u origin arning: push.default is unset; its implicit value is changing inGit 2.0 from ’matching’ to ’simple’. To squelch this messageand maintain the current behavior after the default changes, use: git config --global push.default matchingTo squelch this message and adopt the new behavior now, use: git config --global push.default simpleWhen push.default is set to ’matching’, git will push local branchesto the remote branches that already exist with the same name.In Git 2.0, Git will default to the more conservative ’simple’behavior, which only pushes the current branch to the correspondingremote branch that ’git pull’ uses to update the current branch.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)To git@bitbucket.org:dft/ppgame.git ! [rejected]master -> master (fetch first)error: failed to push some refs to ’git@bitbucket.org:dft/ppgame.git’hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., ’git pull ...’) before pushing again.hint: See the ’Note about fast-forwards’ in ’git push --help’ for details./D/PC/game (master) git status n branch masternothing to commit, working directory clean/D/PC/game (master)git pull -u originwarning: no common commitsOZLremote: Counting objects: 2190, done.remote: Compressing objects: 100% (1971/1971), done.remote: Total 2190 (delta 184), reused 2171 (delta 175)Receiving objects: 100% (2190/2190), 27.91 MiB | 256.00 KiB/s, done.Resolving deltas: 100% (184/184), done.From bitbucket.org:dft/ppgame * [new branch] master -> origin/masterThere are no candidates for merging among the refs that you just fetched./D/PC/game (master) git status n branch masterUntracked files: (use 'git add <file>...' to include in what will be committed)/D/PC/game (master) git push -u origin master o git@bitbucket.org:dft/ppgame.git ! [rejected]master -> master (non-fast-forward)error: failed to push some refs to ’git@bitbucket.org:dft/ppgame.git’hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Integrate the remote changes (e.g.hint: ’git pull ...’) before pushing again.hint: See the ’Note about fast-forwards’ in ’git push --help’ for details.

问题解答

回答1:

Updates were rejected because the tip of your current branch is behind提示不是说的很清楚了么,你的远程仓库的分支比本地的代码要新所以有冲突,你要么把冲突解决掉再提交要么开新分支提交要么就直接git push --force(多人协作请慎重-。-)。git pull不行是因为你修改了本地,所以远程过来的时候又会有冲突。建议多人协作的时候还是开分支好点。

相关文章: