Shallow update not allowed (git > 1.9)

后端 未结 4 1251
忘掉有多难
忘掉有多难 2021-01-13 15:15

There are a lot of answers stating that git 1.9 removes limitations of shallow clones. Nevertheless, I\'m using 2.6.1 and still having the following basic issue:

Fir

相关标签:
4条回答
  • 2021-01-13 15:51

    I'm answering my own question.

    I tried going the other way around and adding urxvt-perls as a remote for target, then fetching from there. This fails because of the same reason but led me closer to a solution. From the git-fetch man:

      --update-shallow
           By default when fetching from a shallow repository, git fetch
           refuses refs that require updating .git/shallow. This option
           updates .git/shallow and accept such refs.
    

    Now, using this option allows the shallow fetch. So the previous question becomes: Is it possible to specify that --update-shallow behavior while pushing? Well, there is an option for that:

    receive.shallowupdate
        If set to true, .git/shallow can be updated when new refs require
        new shallow roots. Otherwise those refs are rejected.
    

    I'm still trying to set this in github and the likes, though.

    0 讨论(0)
  • 2021-01-13 15:55

    Use git merge --squash.

    If your remote is shallow and you want to merge from it, compress that merge into a single commit without the need to copy a history of commits (which shallow refs hide).

    0 讨论(0)
  • 2021-01-13 16:01
    git fetch --unshallow
    
    git push target master -f
    
    0 讨论(0)
  • 2021-01-13 16:07

    Well on Linux repo server... this

    git config --local --add receive.shallowUpdate true
    

    resulted in this being added to the repo config file.

    [receive]
        shallowUpdate = true
    

    So maybe if you can add that to the repo config file.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题