代码之家  ›  专栏  ›  技术社区  ›  Marcin Nabiałek

Git-无法执行推送

  •  0
  • Marcin Nabiałek  · 技术社区  · 12 年前

    我不是Git新手。我下载了Windows的SourceTree,并尝试使用Git。

    我已经创建了Git存储库。然后我克隆了这个存储库。然后,我在克隆的存储库中创建了文件并提交了它。现在,我想将更改推送到主存储库,并解决它的问题。

    当我为克隆存储库中的主分支选择“推到源”时,我会收到以下消息:

    remote: error: refusing to update checked out branch: refs/heads/master[K
    remote: error: By default, updating the current branch in a non-bare repository[K
    remote: error: is denied, because it will make the index and work tree inconsistent[K
    remote: error: with what you pushed, and will require 'git reset --hard' to match[K
    
    remote: error: the work tree to HEAD.[K
    remote: error: [K
    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to[K
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into[K
    remote: error: its current branch; however, this is not recommended unless you[K
    
    remote: error: arranged to update its work tree to match what you pushed in some[K
    remote: error: other way.[K
    
    remote: error: [K
    
    remote: error: To squelch this message and still keep the default behaviour, set[K
    
    remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.[K
    To D:\DaneAplikacji\GIT Repos\katalog
    
     ! [remote rejected] master -> master (branch is currently checked out)
    
    error: failed to push some refs to 'D:\DaneAplikacji\GIT Repos\katalog'
    

    我想我做错了什么。如何将这些更改推送到主存储库?

    1 回复  |  直到 12 年前
        1
  •  0
  •   Marcin Nabiałek    12 年前

    我试着用TortoiseGit做同样的事情,效果也是一样的。在使主存储库成为裸存储库之后,我现在可以将更改推送到该主存储库