
To set the cache in memory to last for a particular amount of time, here 3600 seconds (i.e., 1 hour): git config -global credential.helper 'cache -timeout=3600' Git config -global credential.helper wincred Git config -global credential.helper osxkeychain Git config -global credential.helper cache To cache in memory, in the MacOS keychain, or in the Windows keychain, choose the relevant one of these three invocations: # in memory: Your credentials can be stored in the keychain of your operating system or cached in memory or in a file. You can save, or cache, your credentials so that you don't have to reenter them each time you interact with the remote repository.


#GIT CONFIG USERNAME PASSWORD#
Saving your password or token to avoid entering it If you're just interacting with repositories, you probably want to simply select 'repo' as the "scope". You can create a token using these instructions or simply go here. One good option is to use a personal authentication token in place of a password. You'll be asked to enter your username and password (where the latter could be either your GitHub password or your personal authentication token).Īs of fall 2021, GitHub will no longer allow usage of a password alone. You can clone a repository using HTTPS like this: git clone The standard way to interact with a repository is via HTTPS. Using HTTPS with a personal authentication token or a password In what follows, I'll refer to the account or organization the repository exists in as ACCOUNT and the repository as REPO. With either of the first two approaches you can avoid entering a username and password each time you interact with the remote repository, as discussed below.īefore going into details, note that you can run the following (generally run from a directory within a repository) to see how things are configured: git config -l Using your GitHub password with 2-factor authentication.Using a personal authentication token or password.There are three main approaches you can take: This documentation focuses on GitHub but the ideas are relevant for other platforms. Git provides multiple protocols for authenticating to and interacting with remote Git repositories.
#GIT CONFIG USERNAME HOW TO#
This documentation outlines how to connect to remote Git repositories, in particular how to avoid entering a password or authentication token each time.

Most Unix/Linux users will already have an SSH key pair created and configured in their home directory and upload the existing public key. In general, it generates a compatible public/private key combination on the machine and uploads the public key to your Git server. The process for configuring SSH keys varies slightly for each Git server.
#GIT CONFIG USERNAME UPDATE#
The easiest way to enable SSH for a Git repository is to use SSH for the protocol when cloning it: $ git clone :group/project.gitįor an existing repository, we can update the remote with the following command: $ git remote set-url origin :group/project.git

They also require additional steps to set up SSH keys on both the server and client, which can be cumbersome in large organizations. Some networks or proxies may block these ports, making communication with the remote server impossible. The main downside to using SSH is that it uses non-standard ports. SSH keys are harder to guess than a password and can easily be revoked if they become compromised.
