Storing username and password in Git
In Terminal, enter the following to enable credential memory:
$ git config --global credential.helper cache
You may update the default password cache timeout (in seconds):
# This cache timeout is in seconds
$ git config --global credential.helper 'cache --timeout=3600'
You may also use (but please use the single quotes, else double quotes may break for some characters):
$ git config --global user.name 'your user name'
$ git config --global user.password 'your password'
Actually what you did there is setting up the author information, just for the commits. You didn't store the credentials. credentials can be stored in 2 ways:
- using the git credential functions: https://git-scm.com/docs/git-credential-store
- change the origin url to "https://username:[email protected]".
- a third alternative is to use an ssh key (as @StephenKitt said). For github configuration, you can find all needed information in GitHub help page
Copied this from git scm
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
[several days later]
$ git push http://example.com/repo.git
[your credentials are used automatically]