DEV Community

TechFixDocs
TechFixDocs

Posted on • Originally published at techfixdocs.my.id

How to Fix: Unable to fetch particular commit hash from gerit error: Server does not allow request for unadvertised object

Error fixing server does not allow request for unadvertised object in gerit config.

The Problem

The error 'Server does not allow request for unadvertised object' occurs when Git is unable to fetch a particular commit hash from a remote server. This issue affects users who have updated their manifest file with clone-depth=1 and are attempting to sync their repository.This error can be frustrating, especially when the user has made changes to their Gerrit configuration to accommodate shallow cloning. However, with the right troubleshooting steps, it is possible to resolve this issue and successfully fetch the required commit hash.
🛑 Root Causes of the Error

                The primary reason for this error is that Git is unable to verify the existence of the requested object on the remote server. This can occur when the object is not present in the server's index or when the server does not support shallow cloning.An alternative cause could be a misconfigured Gerrit configuration, which may lead to incorrect settings for uploadpack. However, based on the provided configuration, this seems unlikely.

            🔧 Proven Troubleshooting Steps

                Update Gerrit Configuration

                    Step 1: Check the Gerrit configuration file for any inconsistencies or typos.Step 2: Verify that the `allowTipSha1InWant`, `allowReachableSHA1InWant`, and `allowAnySHA1InWant` settings are set to true, as they enable Git to request objects from the remote server.Step 3: Make sure that the Gerrit configuration is correctly configured for shallow cloning by checking the `clone-depth` setting in the manifest file.



                Use a Different Remote Server

                    Step 1: Try fetching the commit hash from a different remote server to see if the issue persists.Step 2: Check if the remote server has any issues or limitations that may be causing the error, such as network connectivity problems or server overload.


            🎯 Final Words
            To resolve the 'Server does not allow request for unadvertised object' error, first verify and update your Gerrit configuration to ensure correct settings for shallow cloning. If the issue persists, try using a different remote server to fetch the required commit hash.
Enter fullscreen mode Exit fullscreen mode

Full step-by-step guide with screenshots: Read the complete fix here

Found this helpful? Check out more verified tech fixes at TechFixDocs

Top comments (0)