Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make git remember the password for WebDAV remotes?

Tags:

git

passwords

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.

like image 639
millimoose Avatar asked Feb 10 '10 00:02

millimoose


People also ask

How do I get git to stop asking for password?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

How do I store multiple credentials in git?

There are currently three options for storing credentials that Git Credential Manager Core (GCM Core) manages on Linux platforms: freedesktop.org Secret Service API. GPG/pass compatible files. Plaintext files.

How do I stop git push from username and password?

When you use https for Git pull & push, just configure remote. origin. url for your project, to avoid input username (or/and password) every time you push. Optional, the username to use when needed.


1 Answers

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.

like image 67
millimoose Avatar answered Sep 21 '22 18:09

millimoose