Octopress - 源分支突然推动掌握

时间:2014-12-10 10:37:23

标签: git github octopress

问题出现了一段时间:

$ git push origin source
To git@github.com:Loremaster/Loremaster.github.io.git
 ! [rejected]        source -> master (fetch first)
error: failed to push some refs to 'git@github.com:Loremaster/Loremaster.github.io.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 integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

当我推送当前的源分支时,它突然想将其推送到主分支(这是错误的,我想将本地源分支推送到远程源分支)。我记得以前我没有遇到过这样的问题,但现在我已经有了。当我部署我的博客然后一切正常(它被部署到主人)但我无法更新我的源。解决这个问题的最佳方法是什么?

这里也是git remote

$ git remote -v
octopress   git://github.com/imathis/octopress.git (fetch)
octopress   git://github.com/imathis/octopress.git (push)
origin  git@github.com:Loremaster/Loremaster.github.io.git (fetch)
origin  git@github.com:Loremaster/Loremaster.github.io.git (push)

以下是git config --get-regexp remote

$ git config --get-regexp remote
remote.octopress.url git://github.com/imathis/octopress.git
remote.octopress.fetch +refs/heads/*:refs/remotes/octopress/*
branch.source.remote origin
remote.origin.url git@github.com:Loremaster/Loremaster.github.io.git
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*

$ git branch -avvv
* source                                  3eb4c8d [origin/master] Grammar fix.
  remotes/octopress/2.5                   5a6b8e4 Merge pull request #1378 from librehat/patch-1
  remotes/octopress/2.5-simplify-rakefile 277f702 Move install and list tasks into separate files.
  remotes/octopress/3.0                   0b44a79 Merge branch '3.0' of github.com:imathis/octopress into 3.0
  remotes/octopress/HEAD                  -> octopress/master
  remotes/octopress/commander             d489676 Changed config tag to use standard var names (aesthetic)
  remotes/octopress/gh-pages              4381053 Fix missing 'blockquote' in example, closes #229
  remotes/octopress/guard                 7bdab0e Added javascript asset management and improved Rakefiles and configuration for themes and plugins. - Added Guard for file watching - Configs can be automatically reloaded - Static asset changes do not trigger Jekyll build - CommonJS modular js support proved by stich-rb - Javascript is concatenated and uglified - Environment variables toggle uglify and fingerprinting - New Jekyll plugin config_tag - New Jekyll plugin javascript_assets_tag - Added theme specific configurations - Custome Jekyll Guard to the rescue - Install, Generate, Watch, and Preview work with Guard now. - Now configs are no longer tracked by Octopress, only theme defauts are. - Console messages can be colorized. - misc config reorganization and improvements
  remotes/octopress/jekyll-1-3            fc73997 Jekyll now ships with this method in Site, use it!
  remotes/octopress/linklog               1750830 Merge pull request #800 from mxmerz/linklog
  remotes/octopress/master                78defff Merge pull request #1443 from wickedshimmy/patch-1
  remotes/octopress/migrator              9b59940 migrating 'source' and 'sass'
  remotes/octopress/refactor_with_tests   8fe52e1 cucumber tests
  remotes/octopress/rubygemcli            9f54cbd Add plugin-include-array to core plugins.
  remotes/octopress/site                  53b2df0 Merge pull request #1252 from kendaleiv/patch-1
  remotes/octopress/site-2.1              98bd6c9 Merge pull request #1374 from imathis/site
  remotes/origin/master                   3eb4c8d Grammar fix.
  remotes/origin/source                   251a4d4 Small addition.

1 个答案:

答案 0 :(得分:4)

git remote不是这里唯一的因素 git branch -avvv有助于查看哪个分支与 remote tracking branch 相关联:它显示现在的源与远程跟踪分支origin/master而不是{{1}相关联}}

您可以使用以下命令重置本地分支origin/source的远程跟踪分支:

source

请参阅" Make an existing Git branch track a remote branch?"

然后,如果git branch -u origin/source source 设置为git config push.default(对于Git 1.9+),则simple(在git push分支上签出时)就足够了