Pearshaped Monkey Business

Caching credentials with git

Tags: , ,

The issue

I use a gitea instance for my git hosting. A firewall hides the service for ssh access unless I am in the local network. So I have to use https for the git URL, which forces me to use a username and password when using the command line.

The solution

Luckily, the password can be cached when setting the git configuration:

git config --global credential.helper "cache --timeout=3600"

to cache the password entered for the timeout specified. In the example above, the password is cached for 1 hour. The default timeout is 15 minutes.

Found via: Using https:// in git without username and password | by Maxwell Obi | Medium