---
tags: [git]
created: Sunday, April 13, 2025
---

# Git access with HTTPS and credentials

If not using SSH, use HTTPS. However in order to combine this with 2FA it is
necessary to use an access token as the pass, not your actual password.

Create an access token in your remote Git client (GitHub, Forgejo).

Then, clear any existing credentials with:

```sh
git config --global --unset credential.helper
```

Set Git config to use store mode:

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

Do a push or pull in a repo to prompt authentication. Put in username but
credential as password. You should be able to login.

Confirm the credential has been added by viewing the credential file at the root
of your home directory:

```sh
cat ${HOME}/.git-credentials
```
