This has been working for me:
1. Set credential hepler to store
$ git config --global credential.helper store
2. then verify if you want:
$ git config --global credential.helper
store
Simple example when using git bash quoted from Here (works for current repo only, use --global
for all repos)
$ 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]
Will work for VS Code too.
More detailed example and advanced usage here.
Note: Username & Passwords are not encrypted and stored in plain text format so use it on your personal computer only.