保护Git中的敏感信息 [英] Protecting sensitive information in Git

查看:99
本文介绍了保护Git中的敏感信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个我正在开发的项目,那就是博客。在这个博客中,我有一个包含敏感信息的配置文件。当我决定将这个项目推送到Github时,我希望配置文件充满示例数据而不是我的敏感数据。什么是最好的,也是最广泛使用的实现方法?

b
$ b


  1. 用伪数据填充配置文件,提交更改并推送至GitHub 在跟踪的文件中:



    git update-index --assume-unchanged config-file


  2. 使用敏感信息填充配置文件


Assume I have a project I'm working on that is a blog. In this blog I have a config file with sensitive information in it. When I decide to push this project to Github, I want the config file filled with example data instead of my sensitive data. What is the best, and most widely used, method of achieving this?

解决方案

One possible approach is:

  1. fill the config file with dummy data, commit changes and push to GitHub
  2. configure git to ignore changes in tracked file:

    git update-index --assume-unchanged config-file

  3. fill the config file with sensitive information

这篇关于保护Git中的敏感信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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