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

偶尔善良 提交于 2020-01-03 11:37:26

问题


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

$ git fetch origin 3a2ceef391af73994dfeb0d8ef57ed6a52ef4238

and it is showing this error,

error: Server does not allow request for unadvertised object 3a2ceef391af73994dfeb0d8ef57ed6a52ef4238

How to solve this problem?


回答1:


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>



回答2:


git submodule sync as pointed in https://github.com/AppImage/AppImageKit/issues/511 works for me.




回答3:


You can follow the below steps to solve the above error .

> git init 
> git pull <reponame> branchname(optional) 
> git reset --hard <commit_id>

Note:make sure that You have committed and pushed your changes from local to remote already as reset --hard will leave any unsaved changes from local and it moves completely and get the files and folders of the commit which is irreversible with any changes not pushed. You may have a look in to these as well.

https://www.pylabz.com/2019/08/using-python-to-pull-files-of-git-hub.html#more

https://medium.com/@deepakr6242/using-python-to-extract-files-from-git-hub-repo-through-commits-id-2bdf76b2e0fd




回答4:


I got the same error and none of these resolved it. It turned out that I hadn't pushed submodule changes from my other computer (this would give 404 error when you click on submodule folder on GitHub). So pushing submodule, committing parent and pushing that as well resolved the error.

Other solutions are git submodule update --recursive and this.



来源:https://stackoverflow.com/questions/51001919/how-to-solve-git-error-server-does-not-allow-request-for-unadvertised-object-3a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!