Dew*_*ser 7 git commit-message commit
我的问题:使用https:// URL时,cygwin git似乎没有正确提示凭据,所以我在URL中使用了用户名和密码.不幸的是,当我执行"get pull"时,它会自动提交包含密码的完整URL的消息.在我推动改变之前,我没有注意到这一点.
如何编辑旧提交消息以根除URL中的密码?
我的共享git repo在我自己的服务器上.如有必要,我可以对回购做手术.
关于如何更改配置的说明(即不使用Cygwin,不要使用https)是不必要的 - 我正在尝试处理已经完成的工作.
是的,我可以并且将刻录密码,但我仍然想修复它.
要从 git 存储库及其历史记录中完全删除文件,请使用这些命令。
# Check out the remote repo
git clone git://host/path/repo.git
cd repo
# Clobber the file in your checkout
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch file-to-purge.txt' --prune empty --tag-name-filter cat -- --all
# Make sure you don't accidentally commit the file again
echo file-to-purge.txt >> .gitignore
git add .gitignore
git commit -m "Prevent accidentally committing this again" .gitignore
# Push the edited repo. This will break other people's clones, if any.
git push origin master --force
有关更多信息,请参阅GitHub 上的删除敏感数据指南将对您有所帮助。
删除 git-hub 上的敏感数据的链接很有用。然而,我发现了一个非常简单易用的工具:Eric Raymond reposurgeon。
这个工具允许我轻松导入我的存储库,列出有问题的提交,编辑它们(我单独这样做)并写出我的存储库的 git 快速导入流。我将该流导入到一个新的存储库中,并将其同步到位。
缺点是我的旧仓库完全死了——我改变了历史。根据文档,使用“git filter-branch”也是如此。
| 归档时间: | 
 | 
| 查看次数: | 3760 次 | 
| 最近记录: |