git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: receive.denyNonNonFastForwards not denying force update

From
Brandon Casey <drafnel@gmail.com>
Date
Aug 21, 2012, 01:53 UTC
Message-ID
<CA+sFfMexCWLza65bVp2uXoqo3+yY5MPBBcGugoEA6UCEwAv6Ow@mail.gmail.com>
In-Reply-To
<7v628dght9.fsf@alter.siamese.dyndns.org>
On Mon, Aug 20, 2012 at 6:22 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
> Sitaram Chamarty <sitaramc@gmail.com> writes:
>
>> On Mon, Aug 20, 2012 at 10:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> John Arthorne <arthorne.eclipse@gmail.com> writes:
>>>
>>>> For all the details see this bugzilla, particularly comment #59 where we
>>>> finally narrowed this down:
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=343150
>>>
>>> What does "at the system level" in your "does *not* work at the
>>> system level." exactly mean?
>>
>> "git config --system receive.denynonfastforwards true" is not honored.
>>  At all.  (And I checked there was nothing overriding it).
>>
>> "--global" does work (is honored).
>>
>> Tested on 1.7.11
>
> Thanks, and interesting.
>
> Does anybody recall if this is something we did on purpose?  After
> eyeballing the callchain starting from cmd_receive_pack() down to
> receive_pack_config(), nothing obvious jumps at me.
>
> Could this be caused by a chrooted environment not having
> /etc/gitconfig (now I am just speculating)?
>
> A quick "strace -f -o /tmp/tr git push ../neigh" seems to indicate
> that at least access() is called on "/etc/gitconfig" as I expect,
> which makes me think that near the beginning of git_config_early(),
> we would read from /etc/gitconfig if the file existed (I do not
> install any distro "git", so there is no /etc/gitconfig on my box).
>
> Puzzled.
Seems to work for me.  Force push was denied when
receive.denyNonFastForwards was set to true in system-level gitconfig.
 Tested with git installed in my home directory, so my system-level
gitconfig was at $HOME/etc/gitconfig.

Sitaram and John, are you sure you modified the correct file? Also be sure you're using the git-receive-pack that expects the system gitconfig at the place that you think it is.

The system-level gitconfig is hard-coded in the git binary and may not
always be at /etc/gitconfig.  It is usually set to be relative to the
installation directory "$prefix" in the Makefile.  I don't think we
expose the path to the system-level gitconfig file anywhere in the ui.
 One way to figure out where it should be is to use 'git config' to
edit it like this:
   git config --system -e

Hopefully your editor exposes the path that it is editing even if you don't have permission to modify it.

I'm thinking that the git-receive-pack binary that you guys used expects the system gitconfig to be in a different location than the one you modified.

-Brandon
Previous: Junio C HamanoNext: Jay Soffian
Message 5 of 20 in “receive.denyNonNonFastForwards not denying force update”
  1. John ArthorneAug 20, 2012
  2. Junio C HamanoAug 20, 2012
  3. Sitaram ChamartyAug 21, 2012
  4. Junio C HamanoAug 21, 2012
  5. Brandon CaseyAug 21, 2012
  6. Jay SoffianAug 21, 2012
  7. Junio C HamanoAug 21, 2012
  8. Jeff KingAug 21, 2012
  9. Junio C HamanoAug 21, 2012
  10. Jeff KingAug 21, 2012
  11. Jeff KingAug 21, 2012
  12. Jeff KingAug 21, 2012
  13. Jeff KingAug 21, 2012
  14. Junio C HamanoAug 21, 2012
  15. Jeff KingAug 21, 2012
  16. Junio C HamanoAug 21, 2012
  17. Junio C HamanoAug 21, 2012
  18. Jeff KingAug 21, 2012
  19. Sitaram ChamartyAug 21, 2012
  20. John ArthorneSep 10, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.