如何编辑过去的git commit,以从提交日志中删除密码? [英] How do I edit past git commits to remove my password from the commit logs?

查看:54
本文介绍了如何编辑过去的git commit,以从提交日志中删除密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题:使用https://URL时,cygwin git似乎无法正确提示输入凭据,因此我在URL中使用了用户名和密码.不幸的是,当我执行获取拉取"操作时,它会自动提交一条带有完整URL(包括密码)的消息.直到我完成更改后,我才注意到这一点.

My problem: cygwin git doesn't seem to correctly prompt for credentials when using https:// URLs, so I used username and password in the URL. Unfortunately when I did a "get pull" it auto-commited a message with the full URL including password. I didn't notice this until after I had pushed the changes.

如何编辑旧的提交消息以消除URL中的密码?

How do I edit old commit messages to eradicate the password in the URL?

我共享的git repo在我自己的服务器上.如有必要,我可以在回购库上进行手术.

My shared git repo is on my own server. I can do surgery on the repo if necessary.

不需要有关如何更改配置的说明(即,不使用Cygwin,不使用https)-我正在尝试处理已完成的事情.

Instructions on how to change my configuration (i.e. don't use Cygwin, don't use https) are unnecessary -- I'm trying to deal with what is already done.

是的,我可以并且将刻录密码,但是我仍然想修复它.

Yes, I can and will burn the password but I'd still like to fix it.

推荐答案

在git-hub上删除敏感数据的链接非常有用.但是,我发现一个非常可以直接使用的工具:Eric Raymond 后备医生.

The link to removing sensitive data on git-hub is useful. However, I found a tool that was very straight-foward to use: Eric Raymond reposurgeon.

此工具使我可以轻松导入我的存储库,列出有问题的提交,对其进行编辑(我是单独进行的),并写出我的存储库的git快速导入流.我将该流导入到一个新的仓库中,并将其重新同步到位.

This tool allowed me to easily import my repo, list the commits with the issue, edit them (I did so individually) and write out a git fast-import stream of my repo. I imported that stream into a new repo and rsync'd it into place.

缺点是我的旧仓库已完全死光-我改变了历史.根据文档,这同样适用于"git filter-branch".

The downside is that my old repo is completely dead -- I changed history. That would be true of using "git filter-branch" as well, according to the docs.

这篇关于如何编辑过去的git commit,以从提交日志中删除密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆