有没有办法让git记住WebDAV遥控器的密码? [英] Is there a way to make git remember the password for WebDAV remotes?

查看:135
本文介绍了有没有办法让git记住WebDAV遥控器的密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Git将更改推送到通过HTTP / WebDAV共享的存储库,并且Git会为访问HTTP远程的每个操作提示输入密码。有没有办法让Git缓存密码/让远程服务器不提示我?



远程网络服务器应该是一个Apache,如有必要可以重新配置。 / p>

解决方案

方法是使用〜/ .netrc,如此Git文档


然后,将以下内容添加到您的$ HOME / .netrc中(您可以不用,但会要求
输入密码的次数):

 机器< servername> 
登入<使用者名称>
密码<密码>

...并设置权限:

  chmod 600〜/ .netrc 




更新:



从git 1.7.9开始,似乎要走的路是本地凭证助手API。 Git附带明文凭证存储区或不太方便但更安全的临时<一个href =http://git-scm.com/docs/git-credential-cache =nofollow noreferrer>凭证缓存。也可以使用第三方凭证助手。到目前为止,我知道本地Windows Credential Store的助手,并且一个与OS X钥匙串集成的软件。 (由Homebrew提供的Git build有一个二进制文件,就像其他OS X Git发行版一样.Github还提供了一个独立二进制文件)。

通常,设置凭证助手一次就足够了:

  git config --global credential.helper wincred 

或者不是 wincred ,请使用适合您平台的助手。 (如果助手可执行文件的名称是 git-credential-wincred ,则设置该选项的值将为 wincred 等)。

凭证助手还支持在同一主机上为不同存储库分别设置不同的凭据集。


I'm working with Git pushing changes to a repository shared over HTTP / WebDAV, and Git prompts for a password for every operation that accesses the HTTP remote. Is there any way to make Git cache the password / have the remote server not prompt me?

The remote webserver should be an Apache and could possibly be reconfigured if necessary.

解决方案

The way is to use ~/.netrc as outlined in step 3 of this Git documentation:

Then, add the following to your $HOME/.netrc (you can do without, but will be asked to input your password a lot of times):

machine <servername>
login <username>
password <password>

...and set permissions:

chmod 600 ~/.netrc

UPDATE:

As of git 1.7.9, it seems the way to go would be the native credential helper API. Git comes with a plaintext credential store or a less convenient but more secure temporary credential cache. It's also possible to use third-party credential helpers. So far I'm aware of a helper for the native Windows Credential Store, and one that integrates with the OS X keychain. (The Git build shipped by Homebrew has a binary for it, as might other OS X Git distributions. Github also provides a standalone binary.)

Generally, it should be sufficient to set up the a credential helper once:

git config --global credential.helper wincred

Or instead of wincred, use whichever helper is appropriate for your platform. (If the name of the helper executable is git-credential-wincred, the value you set the option to will be wincred, etc.)

The credential helpers also support the need to have separate sets of credentials for different repositories on the same host.

这篇关于有没有办法让git记住WebDAV遥控器的密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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