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

Re: Git Commit Notes (fetching/pushing)

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 6, 2023, 20:09 UTC
Message-ID
<ZM/9+YyOAbWWXQtC@nand.local>
In-Reply-To
<D01976C3-4B91-464B-ACF0-78DFFB066747@alchemists.io>
On Sun, Aug 06, 2023 at 12:35:50PM -0600, Brooke Kuhlmann wrote:
Show 15 quoted lines
> I'm noticing issues with GitHub and GitLab when fetching and pushing
> commit notes and wanted to know if there is a correct way to configure
> my Git configuration for working with these servers (or maybe notes
> aren't supported at al)?
>
> Here's my configuration:
>
> ```
> [notes]
>   rewriteRef = refs/notes/commits
>
> [remote "origin"]
>   fetch = +refs/notes/*:refs/notes/*
>   push = +refs/notes/*:refs/notes/*
> ```
It looks like your refspec may not be doing what you think it is.

Here, you set both the default fetch and push refspecs to "+refs/notes/*:refs/notes/*" which means to update anything under the "refs/notes" hierarchy on either side, even when the updates are not fast forwards.

Since you overwrote the default refspec, you end up only pushing the notes, which we see from the response that you got back from GitHub:

> remote: Resolving deltas: 100% (1/1), completed with 1 local object.
> To https://github.com/bkuhlmann/test
>    5811bd44c32b..0f2422597c5d  refs/notes/commits -> refs/notes/commits

Indeed, refs/notes/commits is updated on your bkuhlmann/test repository, which I can fetch from:

    $ git remote add origin git@github.com:bkuhlmann/test.git
    $ git fetch origin 'refs/notes/*:refs/notes/*'
    remote: Enumerating objects: 41, done.
    remote: Counting objects: 100% (41/41), done.
    remote: Compressing objects: 100% (29/29), done.
    remote: Total 41 (delta 14), reused 34 (delta 7), pack-reused 0
    Unpacking objects: 100% (41/41), 4.66 KiB | 1.55 MiB/s, done.
    From github.com:bkuhlmann/test
     * [new ref]           refs/notes/commits -> refs/notes/commits

I suspect you want an additional refspec that gathers any branches or tags that you want to push along with refs/notes/*.

Thanks, Taylor

Previous: Brooke KuhlmannNext: Brooke Kuhlmann
Message 2 of 7 in “Git Commit Notes (fetching/pushing)”
  1. Brooke KuhlmannAug 6, 2023
  2. Taylor BlauAug 6, 2023
  3. Brooke KuhlmannAug 6, 2023
  4. Junio C HamanoAug 7, 2023
  5. Brooke KuhlmannAug 7, 2023
  6. Junio C HamanoAug 7, 2023
  7. Brooke KuhlmannAug 7, 2023

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.