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

前端 未结 8 2646
攒了一身酷
攒了一身酷 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 <file>..." to update what will be committed)
      (use "git restore <file>..." 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.

    0 讨论(0)
  • 2021-02-19 10:00

    According to this answer and the given source it looks like BitBucket does not allow you to fetch a commit id, only references.

    I cannot say if you can configure this behavior, but I think you can:

    1. Pull the branch: git pull origin branchname
    2. Checkout the local commit id: git checkout <commitid>
    0 讨论(0)
提交回复
热议问题