A simpler method is to use personal access tokens at GitHub. This feature can be set up by going to your GitHub account → Settings → Developer settings → Personal access tokens → Generate a personal access token. Make your access control selections, generate, then copy and save your new token. After this, go to your Git project directory and this enter in the terminal:
git remote set-url origin https://YOUR_TOKEN_HERE@github.com/your_user/your_project.git
From now on you can easily do git push from the terminal or Visual Studio Code.