Trouble getting fetching single SHA1s to work with Gerrit 2.13.5

1,395 views
Skip to first unread message

Sebastian Schuberth

unread,
Apr 21, 2017, 5:49:48 AM4/21/17
to Repo and Gerrit Discussion
Hi,

so after reading through [1] we've added to the ".git/config" of one of our projects:

[uploadpack]

            allowTipSHA1InWant = true

            allowReachableSHA1InWant = true


But fetching a SHA1 (which is at the tip of a branch) fails with:

$ git fetch origin 889043605ccdcc933662fadee2be3b4f1db34843
error: Server does not allow request for unadvertised object 889043605ccdcc933662fadee2be3b4f1db34843

This is with Gerrit 2.13.5 and Git client 2.13-rc0 on Linux. We even tried to restart Gerrit in between. Am I missing another configuration that needs to be set in order to be able to fetch single SHA1s?

[1] https://groups.google.com/d/msg/repo-discuss/JwDmV6qcvy0/gD5HPp6UND8J

Regards,
Sebastian

venkatakrishna...@gmail.com

unread,
Jul 6, 2017, 1:32:27 AM7/6/17
to Repo and Gerrit Discussion
Hello,
I've nearly the same problem. Our gerrit projects are bare repositories. So, there doens't exist a ".git" directory, thus, I wonder if the "config" or ".gitconfig" are the files that must be modified.
I did try modifying them both, but git fetch silently fails.

If you already have managed to solve the problem, please post your observations

thanks,
Venkat.

Matthias Sohn

unread,
Jul 6, 2017, 5:09:12 AM7/6/17
to venkatakrishna...@gmail.com, Repo and Gerrit Discussion
On Thu, Jul 6, 2017 at 7:32 AM, <venkatakrishna...@gmail.com> wrote:
Hello,
I've nearly the same problem. Our gerrit projects are bare repositories. So, there doens't exist a ".git" directory, thus, I wonder if the "config" or ".gitconfig" are the files that must be modified.
I did try modifying them both, but git fetch silently fails.

configuration options in repository.git/config are specific for this repository, 
configuration options in ~/.gitconfig are global for the logged on user
the repository config is more specific and can override a setting defined in the global configuration

Sebastian Schuberth

unread,
Jul 6, 2017, 5:17:36 AM7/6/17
to Matthias Sohn, venkatakrishna...@gmail.com, Repo and Gerrit Discussion
On Thu, Jul 6, 2017 at 11:09 AM, Matthias Sohn <matthi...@gmail.com> wrote:

>> Hello,
>> I've nearly the same problem. Our gerrit projects are bare repositories.
>> So, there doens't exist a ".git" directory, thus, I wonder if the "config"
>> or ".gitconfig" are the files that must be modified.
>> I did try modifying them both, but git fetch silently fails.
>
>
> configuration options in repository.git/config are specific for this
> repository,
> configuration options in ~/.gitconfig are global for the logged on user
> the repository config is more specific and can override a setting defined in
> the global configuration

Sure. I think the confusion arises because I was saying to put the
"[uploadpack]" settings into ".git/config" (which does not exist in a
bare repository), whereas I should have said to put the settings into
"$SITE/git/<project_name>.git/config" where "<project_name>" needs to
be replaced with the actual project name.

In any case, I could not get fetching single SHA1s to work with Gerrit.

--
Sebastian Schuberth

Martin Nonnenmacher

unread,
Aug 31, 2017, 4:38:29 AM8/31/17
to Repo and Gerrit Discussion, matthi...@gmail.com, venkatakrishna...@gmail.com
I had the same problem when running a "git fetch origin [sha1]" with Git 2.13.0 and Gerrit 2.13.5. After upgrading to Git 2.14.1 the problem disappeared, so it seems there is a compatibility issue with these Git and Gerrit versions. I'm not sure about the uploadpack configuration on the Gerrit server though.

Sebastian Schuberth

unread,
Aug 31, 2017, 4:57:49 AM8/31/17
to Martin Nonnenmacher, Repo and Gerrit Discussion, matthi...@gmail.com, venkatakrishna...@gmail.com
Indeed my issue seems to have been fixed in Git 2.14:

https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt#L58

Thanks for pointing that out!

--
Sebastian Schuberth
> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/repo-discuss/NYr9FnbJY90/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> repo-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sebastian Schuberth

unread,
Aug 31, 2017, 5:07:23 AM8/31/17
to Repo and Gerrit Discussion, martin.no...@googlemail.com, matthi...@gmail.com, venkatakrishna...@gmail.com
BTW, my hunch is that the server-side allow{Reachable,Tip}SHA1InWant settings still do not work in Gerrit, but as in Gerrit each change / commit is at the tip of some refs/changes, Git client 2.14 is able to fetch it nonetheless.

Regards,
Sebastian

sunilkgb

unread,
Jul 26, 2018, 8:40:15 AM7/26/18
to Repo and Gerrit Discussion
Hi All,

I am new to git and gerrit so please bare if my understanding is pale .I have been working on this shallow sync  .we usually to repo init  from gerit project and repo sync to get all the projects content  and I have updated the manifiest files in manifest repo with clone-depth=1 and when  I try to do the repo sync I am getting the error: Server does not allow request for unadvertised object ,I have updated the gerit config with below entries .Do I need to make these changes in every gerit project .git/config file to get rid of this issue ? any help on this would be great 

Geritconfig changes :
[uploadpack]

    allowTipSha1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

Gerit version =2.15
git version =2.17

Regards
Sunil

Gert van Dijk

unread,
Jul 26, 2018, 1:35:47 PM7/26/18
to Repo and Gerrit Discussion
On Thursday, 26 July 2018 14:40:15 UTC+2, sunilkgb wrote:
I have been working on this shallow sync  .we usually to repo init  from gerit project and repo sync to get all the projects content  and I have updated the manifiest files in manifest repo with clone-depth=1 and when  I try to do the repo sync I am getting the error: Server does not allow request for unadvertised object ,I have updated the gerit config with below entries .Do I need to make these changes in every gerit project .git/config file to get rid of this issue ? any help on this would be great 

Geritconfig changes :
[uploadpack]

    allowTipSha1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

I believe it's a git configuration, not a Gerrit configuration that should be used. You may be successful in setting it globally for all projects using a global gitconfig file where JGit (as embedded in Gerrit) will pick it up. As the same user as your Gerrit server is running, perform:

  git config --global uploadpack.allowTipSha1InWant true
  git config --global uploadpack.allowReachableSHA1InWant true
  git config --global uploadpack.allowAnySHA1InWant true

(Or just edit the $HOME/.gitconfig yourself.)

HTH

sunilkgb

unread,
Jul 27, 2018, 3:36:15 AM7/27/18
to Repo and Gerrit Discussion
I tried setting those in in my $HOME/.gitconfig but it didn't work ,problem is I am an end user just trying to do the repo init and repo sync for build purpose ,Our project is combination of different gerit projects from different clients ,my hunch is that I may need to update these configuration in every project repo git configuration i.e  .repo/projects/foo/bar/foo.git .and one more thing when I make these configuration changes for every project does it still work for existing commit hash ?  or only for new commits pushed after these configuration changes  ??

Gert van Dijk

unread,
Jul 27, 2018, 4:07:04 AM7/27/18
to Repo and Gerrit Discussion
On Friday, 27 July 2018 09:36:15 UTC+2, sunilkgb wrote:
I tried setting those in in my $HOME/.gitconfig but it didn't work ,problem is I am an end user just trying to do the repo init and repo sync for build purpose ,Our project is combination of different gerit projects from different clients ,my hunch is that I may need to update these configuration in every project repo git configuration i.e  .repo/projects/foo/bar/foo.git .and one more thing when I make these configuration changes for every project does it still work for existing commit hash ?  or only for new commits pushed after these configuration changes  ??

I think these settings are for the Gerrit server, not for your local git client. They are 'uploadpack' settings, so that means they are relevant for servers in a fetch context, if I'm correct. So, try placing this in a <site-path>/git/config file in the git project on the Gerrit server. If that works for an individual repository, you can try to make it global for every project with a ${HOME}/.gitconfig (home for the user Gerrit runs as) or /etc/gitconfig.

Matthias Sohn

unread,
Jul 27, 2018, 5:44:29 AM7/27/18
to suni...@gmail.com, Repo and Gerrit Discussion
On Fri, Jul 27, 2018 at 9:36 AM sunilkgb <suni...@gmail.com> wrote:
On Thursday, July 26, 2018 at 7:35:47 PM UTC+2, Gert van Dijk wrote:
On Thursday, 26 July 2018 14:40:15 UTC+2, sunilkgb wrote:
I have been working on this shallow sync  .we usually to repo init  from gerit project and repo sync to get all the projects content  and I have updated the manifiest files in manifest repo with clone-depth=1 and when  I try to do the repo sync I am getting the error: Server does not allow request for unadvertised object ,I have updated the gerit config with below entries .Do I need to make these changes in every gerit project .git/config file to get rid of this issue ? any help on this would be great 

Geritconfig changes :
[uploadpack]

    allowTipSha1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

I believe it's a git configuration, not a Gerrit configuration that should be used. You may be successful in setting it globally for all projects using a global gitconfig file where JGit (as embedded in Gerrit) will pick it up. As the same user as your Gerrit server is running, perform:

  git config --global uploadpack.allowTipSha1InWant true
  git config --global uploadpack.allowReachableSHA1InWant true
  git config --global uploadpack.allowAnySHA1InWant true

(Or just edit the $HOME/.gitconfig yourself.)

I tried setting those in in my $HOME/.gitconfig but it didn't work ,problem is I am an end user just trying to do the repo init and repo sync for build purpose ,Our project is combination of different gerit projects from different clients ,my hunch is that I may need to update these configuration in every project repo git configuration i.e  .repo/projects/foo/bar/foo.git .and one more thing when I make these configuration changes for every project does it still work for existing commit hash ?  or only for new commits pushed after these configuration changes  ??

Please avoid top posting on this list

These settings work for all commits, these are security relevant policies which can enable use of  commit hashes
instead of refs in git transport commands. Gerrit defines permissions on refs and which commits you can access is
determined by checking if commits are reachable from refs you have read permissions for. Hence these uploadpack
options are off by default. For details see the documentation of git config [1].


-Matthias 
Reply all
Reply to author
Forward
0 new messages