linux - 使用 Git 存储密码有多安全?

标签 linux macos git security

我在工作场所使用 Git,公司政策不允许我以不安全的方式存储密码。有没有比使用 git config credential.helper store 将密码存储到 Git 服务器更好的选择?

附:不能使用 key 验证,因为它在我们的服务器上不允许。

最佳答案

git config credential.helper store 不是很安全;正如它在 documentation 中所说的那样:

Using this helper will store your passwords unencrypted on disk, protected only by filesystem permissions

The ~/.git-credentials file will have its filesystem permissions set to prevent other users on the system from reading it, but will not be encrypted or otherwise protected.

因此它会按原样存储您的密码。 Git 允许在 OSX 上使用你的钥匙串(keychain) git config --global credential.helper osxkeychain,所以它似乎更安全。对于 Linux 系统,您可以使用 git config credential.helper cache ,它将密码存储在您的内存中。或者您可以按照 git help credentials 中的说明编写自己的代码:

You can write your own custom helpers to interface with any system in which you keep credentials. See the documentation for Git's credentials API for details

此外,@VonC 指出了跨平台 GPG-based solution .另见 this question关于 .netrc 文件。

还有gnome-keyring helper对于 Linux(感谢@jazakmeister 的建议)

关于linux - 使用 Git 存储密码有多安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28104581/

相关文章:

java - 基本 Mule ESB 安装和开发

android - 无法从 SDK 管理器的插件 URL 中获取“Google API 8”?

macos - 从命令行关闭 redis 服务器

Git如何更新本地存储库并保留我的更改

仅在 Bower 安装期间 Git 身份验证失败(退出代码 #128)

java - eclipse Git : Can't add folder to index

linux - 打开终端后执行命令,其中使用 ssh 登录远程机器

linux - 在 Linux 上启动时启动脚本的最佳方式是什么

linux - 如何配置 Apache 2 以运行 Perl CGI 脚本?

c - 如何使用 ptrace() 观察进程直到它退出?