我在工作场所使用 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/