【发布时间】:2014-01-30 07:12:28
【问题描述】:
我在 github 上发布了一些代码,但不小心也发布了一些密码,我更改了它们,但它仍然在提交部分中看到。
我怎样才能隐藏那个提交?
【问题讨论】:
-
非常感谢您的回答。
标签: github git-commit github-for-windows
我在 github 上发布了一些代码,但不小心也发布了一些密码,我更改了它们,但它仍然在提交部分中看到。
我怎样才能隐藏那个提交?
【问题讨论】:
标签: github git-commit github-for-windows
清除差异的唯一方法是强制推送。如果多人在同一个分支上工作,你最好让他们知道你正在重写历史。
假设这是你的最后一次提交......
git reset --soft HEAD~
(undo password changes)
git diff
(make sure there are no changes that display the passwords)
(stage/commit changes)
git push origin +branch_name
遵循标准的安全预防措施,如果这些密码与敏感数据相关联,我也会重置它们...
【讨论】:
您可以使用私人 GitHub 电子邮件地址进行未来提交。
GitHub 为每个用户提供一个不回复的电子邮件地址,例如 user-name@users.noreply.github.com。
您可以通过转到https://github.com/settings/emails 并切换Keep my email addresses private 和Block command line pushes that expose my email 来启用它。
【讨论】: