代码之家  ›  专栏  ›  技术社区  ›  Martin

如何阻止git push悄悄地无法发布本地提交

  •  0
  • Martin  · 技术社区  · 6 年前

    我正在处理github回购协议的一个分支,成功推送了两次,但现在git推送悄悄地无法发布我的本地提交:

    $ git version
    git version 1.8.3.1
    
    $ git remote -v
    origin  git@github.com:martinwaite/vault.git (fetch)
    origin  git@github.com:martinwaite/vault.git (push)
    
    $ git status
    # On branch batch_hmac
    # Your branch is ahead of 'origin/batch_hmac' by 2 commits.
    #   (use "git push" to publish your local commits)
    
    $ git push
    $ git push origin batch_hmac
    $ git push origin HEAD
    $ git status
    # On branch batch_hmac
    # Your branch is ahead of 'origin/batch_hmac' by 2 commits.
    #   (use "git push" to publish your local commits)
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   Martin    6 年前

    尝试使用https重置远程服务器的url:

    git remote set-url origin https://github.com/martinwaite/vault.git
    

    然后获取远程回购:

    git fetch
    

    git branch -vv
    

    如果不是这样,则让本地分支跟踪远程分支

    git branch -u origin/batch_hmac
    

    最后推送提交

    git push
    

    如果仍然不起作用,请尝试 --force

    git push --force