# Save Credentials for Remotes in Git

SSH Key based login for Git works most of the times, except for the time when we add a HTTPS based remote (obviously with access token!), then it's annoying to put in your access token every single time, and that we can fix with [Git Credential Storage](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage), example given below -

## Setup Git Credential Storage Globally

```bash
git config --global credential.helper store
```

**Note:** `--global` argument tells Git to set this globally; credential file is stored `~/.git-credentials`.

## Setup Git Credential Storage on a Single Repository

```bash
cd /path/to/the/respository
git config credential.helper store
```

***Source:*** [***Sentry Answers***](https://sentry.io/answers/save-credentials-for-remotes-in-git/)

***Reference:*** [***Git Book***](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.devjugal.com/git/save-credentials-for-remotes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
