VS Code Git push is not pushing the code to remote

Viewed 27668

I cloned a GIT repo in my device and started editing the code using VSCode. Then I made several changes to my code and committed it successfully.

But when I tried to push it from push menu it doesn't seem to be working. It shows that it's syncing, but that goes on forever.

I couldn't find any settings to configure credentials of git.

5 Answers

I was just experiencing something similar. Although the issue OP describes is the push continuing to sync but failing to connect, in what sounds like an initial commit. In my case it appeared as though all pushes were successful, in an existing repo/project where I've never had issues, nor had to do any initial git configurations inside VS... Things have always just worked, until the past few days, I just noticed none of my pushes actually made it to the repo.

But the title of the post is still relevant, so I'll answer in case it helps anyone else:

A simple VS Code update fixed my issue. While troubleshooting, I noticed a notification on the gear icon in the bottom left - which was an update ready to install. Once the update was installed and VS code restarted, I tried another pull, and then a push and everything's back to normal. Three commits finally found their way to the repo.

I just had this problem with an existing and previously used repo, after a complete re-installation of my Windows and the development tools. It was may be due to changes with the way authentication is now handled by Git (Git Credential Manager?, as I noticed during installation).

Anyway, to solve it, I had to manually run:

git push

It asked me for an authentication option, and once I selected it and completed it, VS Code sync is now working fine.

I was having the same issue and was hoping to give a little more insight, as my vscode was stock and I ran into this problem right after cloning a repo. I would first recommend tig, as I was able to get more information on the problem rather than just try anything that came up on SO.

When I first used tig, I found that when I said commit with vscode via the check mark, it seemed to show up and have a commit, but didn't show up on GitHub.com. I then realized that vscode doesn't actually push the code with the check mark button, and you have to open a terminal either in vscode or the folder and actually git push origin main.

I recommend tig because in another similar problem I was pushing to different refs than main, which were only found with tig.

Related