Skip to content

Comment on Why does GitHub let me commit as other people?

Comments

This isn't a github problem, git lets you set your user.name and user.email as anything you like. In addition, you can rebase and rewrite the history to change former commits to be from whomever you like.

It's a feature, not a bug - this is how git is able to seamlessly interoperate with other VCS, like SVN. The SVN user id and email is displayed as the git commit author. Having to verify this information would be very complicated and essentially break interoperability between VCS's. In addition, mutable history means you could go back and fix up the history, remove misspellings from names, update your git repo to show a new email address, etc. Git follows the standard user philosophy of letting unix users do what they want, and simply warning them if they push rewritten history to a repository.

It's a useful feature in git, but a bug in github.

In my company's git repo, yes, I want full control.

In a public forum where lots of my public image is tied up, I don't want people to be able to impersonate me.

It's a tricky one to solve, though. Not sure how it would be achieved without demanding that every commit is GPG signed.

It seems like it'd be possible to at least restrict your GitHub account from appearing linked to a commit unless it's a repo you've contributed to directly (by pushing or with a pull request).

That would need to be configurable, though -- it would kind of suck to lose credit for commits just because they weren't merged using GitHub's tools.

@davidbanham

May I quote you on that? I think I focused too much on the cool factor and not the problem I was trying to address. (Which you summed perfectly.)

Why is PGP signing an unacceptable solution in your use case? It sounds like that's what I would do given a pressing need to ID a committer.

I acknowledged that. It's one of those features that isn't perfect when implemented.

There should be a way to stop these commits from happening under my name without going to the computer physically or rewriting history every time it happens. And that only works if you have access to the repository.

I think it would be reasonable to allow a GitHub user to control whether their account is linked to commits (say, to require the commit be signed).

On the other hand, allowing a user to completely restrict the ability to make commits identifying them as the author would mean that J. Q. Hacker could retroactively interfere with any project they had previously committed to simply by enabling that setting.

That would break the distributed nature of Git: if you'd committed to code locally, and I pulled from you, I'd then not be able to push any changes I made up to GitHub, because the change set included commits from you.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.