Git http - 安全地记住凭据 [英] Git http - securely remember credentials
问题描述
当通过 HTTP(S) 连接到远程存储库时,有没有办法让 git 安全地记住我的凭据?
Is there a way to securely let git remember my credentials when connecting to remote repositories over HTTP(S)?
我已经尝试了 core.askpass
方法>git-config 让外部脚本提供我的凭据.虽然它工作得很好,但用户名和密码仍然以纯文本形式存储在小 shell 脚本中.
I've tried the core.askpass
approach detailed in git-config
to let an external script supply my credentials. Although it works great the username and password is still stored in plain text in the small shell script.
推荐答案
git
在通过 HTTP 运行时调用 cURL.您可以通过在用户的主目录中设置 .netrc
文件并将其设为用户私有(Linux 中的 0600)来存储安全凭据.
git
invokes cURL when running over HTTP. You can store secure credentials by setting up a .netrc
file in your user's home directory, and making it private to the user (0600 in Linux).
文件内容提供每个远程域的用户名和密码.
The contents of the file provide the username and password per remote domain.
machine myRemoteServer
login myUserName
password s3cret
见https://stackoverflow.com/questions/3947530/git-push-Fatal-failed/7177690#7177690 用于完整的服务器端配置,可以轻松包含对 ldap 服务器的调用.
See https://stackoverflow.com/questions/3947530/git-push-fatal-failed/7177690#7177690 for full server side configuration, which can easily include calls to your ldap server.
这篇关于Git http - 安全地记住凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!