Save username and password in GIT

Run

$ git config --global credential.helper store

After running this command, when you push to your repository or pull from your repository, you'll get asked username and password for first time. Then credentials will be stored into your home directory named .git-credentials file in plaintext.

You can use this command to store your credentials into cache memory for specific time(in seconds).

$ git config --global credential.helper 'cache --timeout=14400'

This command will remember your credentials for 4 hours. Your username and password will be asked for the first time during push or pull as well.

These commands will store your username, password and email in .gitconfig file into your home directory.

$ git config --global user.name "your username"
$ git config --global user.password "your password"
$ git config --global user.email "your email"

Storing global email would help you to count your github contribution during commits.

Comments

Shahnawaz Hossan 2019-2024 | Crafted with