How to solve git error: Server does not allow request for unadvertised object 3a2ceef391af73994dfeb0d8ef57ed6a52ef4238?

前端 未结 8 2685
攒了一身酷
攒了一身酷 2021-02-19 09:18

I wanted to pull commit \"3a2ceef391af73994dfeb0d8ef57ed6a52ef4238\" from branch android. I used the command:

$ git fetch origin 3a2ceef391af73994dfeb0d8ef57ed6a         


        
8条回答
  •  逝去的感伤
    2021-02-19 09:55

    This can happen when you are pointing to submodule commit that has been removed through a history re-write or squash. The best you can do is:

    • First get a clear picture of what your team has been doing so you know what it should look like.
    • Update your local with a git pull and then find the closest commit that works with your branch (it may be the latest) and then add that to your parent repo. e.g. something like:
    parent-repo$ git fetch
    parent-repo$ cd submodule-a
    submodule-a$ git pull
    submodule-a$ git checkout best-commit-according-to-team-and-your-branch
    submodule-a$ cd ../
    parent-repo$ git status
    ...
    Changes not staged for commit:
      (use "git add ..." to update what will be committed)
      (use "git restore ..." to discard changes in working directory)
      (commit or discard the untracked or modified content in submodules)
            modified:  submodule-a (modified content)
    ...
    git add submodule-a
    git commit -m "updated submodule-a reference"
    

    Once you are happy it is correct and your team agrees you can push it up and the error should go away.

提交回复
热议问题