git refusing to fetch into current branch

前端 未结 7 1609
不思量自难忘°
不思量自难忘° 2020-12-05 03:39

I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message:

fatal: Refusing t         


        
7条回答
  •  情书的邮戳
    2020-12-05 04:13

    In case anyone finds this because they specifically want to fetch into the current branch, you can use the --update-head-ok flag. From the docs:

    -u
    --update-head-ok
    By default git fetch refuses to update the head which corresponds to the current branch. This flag disables the check. This is purely for the internal use for git pull to communicate with git fetch, and unless you are implementing your own Porcelain you are not supposed to use it.

    In some cases we do want to implement our own porcelain commands, e.g., automation and tooling.

提交回复
热议问题