Run the following command:
$ mkdir ~/.git-credentials
$ git config --global credential.helper store
$ git config --global credential.helper `store --file=~/.git-credentials/git.credentials` --add
Then, try to use git push to push some code, it should ask you to enter the username and password. Don’t worry, it just needs for once.
You can check your credentials storage by the following command:
$ vim ~/.git-credentials
也可以直接编辑该文件:
http://username:[email protected]
再运行:
$ git config --global credential.helper store