# Git Password Cache

> A simple way to make Git remember your password

- Author: Franklin Javier
- Published: 2015-08-05
- Language: English
- Tags: tooling
- Canonical: https://franklinjavier.com/blog/git-password-cache/

Every time I do a pull or push from a project cloned via HTTPS, Git asks for my password.
Let's face it, it's annoying, isn't it?

To work around this, you can use the *credential helper* to tell Git to remember your password for
a certain amount of time.

## Example

```bash
$ git config credential.helper cache
```

At this point Git asks for the password to remember it.

```bash
$ git push
Password:
```

Done, it remembered. Now your credentials will be used automatically.

```bash
$ git push

Counting objects: 26, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Total 6 (delta 3), reused 0 (delta 0)
To https://example.com/repo.git
   a577d95..5774c51  bla -> bla
```

## Local vs Global
The first command will remember the password only for that repository. To make it work for all repositories,
add the `global` parameter.

```bash
$ git config --global credential.helper cache
```

## Memorization Time
Git will remember your password for 15 minutes. If you want to
change this time, just add the `timeout` parameter.

```bash
$ git config --global credential.helper 'cache --timeout=3600'
```

The `timeout` parameter receives a value in seconds, so in this case, it will be remembered for 60 minutes (1 hour).

---

If you cloned the repository using SSH, you can authenticate using the SSH key instead of username and password. For more details, [check out this guide](https://help.github.com/articles/generating-ssh-keys/).

## Related posts

- [How I share links with my agents](https://franklinjavier.com/blog/how-i-share-links-with-my-agents/) (2026-10-21): xmd takes a link (an X post, an article, or a page that needs JavaScript) and returns just the content as Markdown. No login, no API key, no MCP.
- [My old MacBook is now a context server](https://franklinjavier.com/blog/old-macbook-context-server/) (2026-10-08): Shared context across coding agents, machines, and projects: my 2017 MacBook stores session history and summaries, with repository checks before resuming work.
- [We published 28 of our agent skills as open source](https://franklinjavier.com/blog/open-source-agent-skills/) (2026-06-26): Stone Giant Studio's internal skills for AI coding agents are now public - markdown files, no dependencies, portable across Claude Code, Cursor, Codex and Gemini CLI.

---

Every page on this site is also available as markdown: request any URL with the `Accept: text/markdown` header. See [llms.txt](https://franklinjavier.com/llms.txt) and the [sitemap](https://franklinjavier.com/sitemap.xml).
