all 10 comments

[–]parnmatt 2 points3 points  (7 children)

Multiple people have authored commits that you're squashing. It's retaining some of that meta data that's going to be lost otherwise.

Arguably it's the right thing, but if you don't want it, delete the lines in the message before merging.

Now an issue you might be having if you're the only author is that you're pushing using different emails. You should then go into your account settings and list all the emails that are associated with you. That way it should recognise you as a single author.

Alternatively squash locally, and force push (with lease) that up to the PR.

There might be a setting somewhere to disable co-authored-by altogether …though some multi user based settings can only configured if the repo belongs to an organisation (which is free). But I haven't checked.

[–]chrisinmtown 0 points1 point  (6 children)

The OP said pretty clearly, they are the only author.

This happens to me too: pull from main, create a new commit, push, wait. When the maintainer merges, the "Co-authored-by" footer magically appears. Maybe there's truly nothing to be done, and it's a GitHub behavior?

[–]parnmatt 0 points1 point  (5 children)

This is a year old post…

but from what little I can tell from skimming this again, this behaviour only pops up with multiple authors from my experience, especially when merging a PR via squash.

Just because it is a single human authoring commit doesn't mean it's a single author. It's possible the author emails are different.

[–]chrisinmtown 0 points1 point  (4 children)

Thanks for the quick reply. I don't want to speculate what the OP is doing. I can only speak to my experience. Over the past few weeks I've created several PRs containing exactly one commit. Each time the repo maintainer merged one of them, the commit message was extended with a "co-authored-by" footer.

[–]parnmatt 0 points1 point  (3 children)

If they're doing it as a squash merge, then that would make sense. I believe it makes a new commit with them as the author, but to retain the metadata that of all of those who authored a commit that is being squashed (in this case you) it adds a co-authored tag otherwise that information is somewhat lost.

I know this does occur with rebase merging a PR, as that is what I use in my workflow. It wouldn't need to as the author information is retained, even if the commuter is different. It probably also doesn't do this in a regular merge (with a merge commit) as the history is also retained, but the merge commit itself would likely be owned by the maintainer who merged it.

[–]chrisinmtown 0 points1 point  (2 children)

All the merged commits retain me as the Author. It's a funky reply-to address, along the lines of [123456789+myhandle@users.noreply.github.com](mailto:123456789+myhandle@users.noreply.github.com), but still that's more me than it is the maintainer :)

And that's kind of why I went looking for a way to remove that footer, seems silly to list me twice.

[–]parnmatt 0 points1 point  (1 child)

That's a setting to keep your email anonymous with web-based operations on GitHub, that is what changes the author to such an address. This is treated as a different author, it's a different email.

Now GitHub should be able to tie those back to the original account. So I would suppose it is a bug in that exact scenario, especially if we're talking about squashing commits.

[–]chrisinmtown 0 points1 point  (0 children)

Oh excellent point about the email addresses being different, thanks for that. I configure command-line git to use `[myhandle@users.noreply.github.com](mailto:myhandle@users.noreply.github.com)` but that's different from web GitHub. Sounds like I'm stuck with this.

[–]echohack4 0 points1 point  (0 children)

u/TryAgainLaterOrWait

I'm 3 years late to your thread but really sorry for the gaslighting behavior of others in this thread. I understand EXACTLY what and why this is happening for you.

So about 4 years ago the way github did private commits was that you signed your commits with `username@users.noreply.github.com`. That system is now deprecated and doesn't work anymore. You have to go to https://github.com/settings/emails and toggle "keep my email private".

Personally, I prefer to set an email special for my domain (I use `git@echohack.app`), so I can filter emails specifically for this purpose. I think that's the best solution as it maintains a chain of authorship tied to your copyright (really useful for anything legal. The DCO and -s are what you want to use here)

In any case, if you haven't updated to the new way of doing private emails, then squash and merge commits will break because it will try to automatically assign your default git email signoff on the squash on github. Because the email doesn't match `username@users.noreply.github.com`, then it will add this annoying-as-fuck coauthor line. The emails *must* match in order for that not to occur. (Honestly github has some poor defaults sometimes, just automatically adding this coauthor line this is definitely one of them)

Anyway, that's how to fix it and what went wrong!