【问题标题】:How Can I hide a commit in GITHUB如何在 GITHUB 中隐藏提交
【发布时间】:2014-01-30 07:12:28
【问题描述】:

我在 github 上发布了一些代码,但不小心也发布了一些密码,我更改了它们,但它仍然在提交部分中看到。

我怎样才能隐藏那个提交?

【问题讨论】:

标签: github git-commit github-for-windows


【解决方案1】:

清除差异的唯一方法是强制推送。如果多人在同一个分支上工作,你最好让他们知道你正在重写历史。

假设这是你的最后一次提交......

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

遵循标准的安全预防措施,如果这些密码与敏感数据相关联,我也会重置它们...

【讨论】:

  • 很抱歉恢复了一个 7 年的帖子,但如果不是最后一次提交,你知道怎么做吗?
【解决方案2】:

您可以使用私人 GitHub 电子邮件地址进行未来提交。

GitHub 为每个用户提供一个不回复的电子邮件地址,例如 user-name@users.noreply.github.com

您可以通过转到https://github.com/settings/emails 并切换Keep my email addresses privateBlock command line pushes that expose my email 来启用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-05-22
    • 2018-07-28
    • 2016-07-12
    • 2013-10-02
    • 2016-05-01
    • 2018-12-23
    • 2018-05-15
    • 1970-01-01
    相关资源
    最近更新 更多