为Git commit 签名

前言
Git commit 伪造攻击
https://github.com/aguerrero/Faking-Git-Commits
Git 本身并没有检查是谁提交的commit。 提交者可以在提交时提供author 和email 信息

git commit --author="Linus Torvalds torvalds@linux-foundation.org" -m "Change grade"

这样,就可以在自己的repo 里伪造一个commit, 看起来是Linus Torvalds 提交的。
当然这可能并不能起到什么攻击,因为只能将commit push 到自己的repo 中。
但在github 这种开源环境中, 很容易造成混乱。

Consider the average CS student that will be searching for jobs after graduation. Such a student may be building a portfolio to present to possible employers, but may not have anything on GitHub that catches too much attention. One way to change that could be to fake some commits from some high profile programmers like Linus Torvalds. Having some commits from Linus may get your project some attention and make people assume you are a better programmer than you really are. After all, if your project was bad, there would be no way Linus would have looked at it and contributed in the first place.

Git 本身提供了使用GPG https://en.wikipedia.org/wiki/GNU_Privacy_Guard 来签名的方式。

Github 上提供了非常完善的说明: https://help.github.com/categories/gpg/

配置好后,就可以在Github 上显示为 Verified

Paste_Image.png

是不是会更酷一点?

如果GPG 的key 对应的email 和commit 的email 不同, github 会把GPG的key 显示为“unverified”。 可以给该
GPGkey 增加 email。 https://www.ahmadnassri.com/blog/github-gpg-keybase-pgp/

GPG 不光可以用户签名git commit, 还可以用来签名邮件,以及加密等。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • GIT分布式版本控制系统最佳实践 这篇文章来自于老男孩教育高级架构师班12期的徐亮偉同学。 首先感谢老男孩架构师班...
    meng_philip123阅读 3,476评论 4 36
  • Git是目前最流行的版本管理系统,也是最先进的分布式版本控制系统(distributed version cont...
    pro648阅读 5,755评论 1 17
  • 以前 有朋友告诉我 成长就是从“哭着哭着就笑了”到“笑着笑着就哭了”的改变 成长就是从“心口如一,情绪挂在脸上”到...
    泰辉宝宝阅读 545评论 0 0
  • 图|网络 文|海子&小柒 今天给大家安利一篇经典诗歌,也是我的最爱---《面朝大海,春暖花开》 海子的这首诗深受...
    小柒說阅读 1,126评论 0 2
  • 这周我们开始了第三本主题《颜色蹦蹦跳》,在这本书里主要让宝贝们认识常见的颜色:红色、黄色、绿色、蓝色等等,那么在《...
    李芳_0712阅读 493评论 0 0