5

I signed up in vs code with git , did all setup , my repository is loading and showing all the modifications done but the commit and push is not working , as i press commit no error shows up. It syncs properly with git . I even tried to remove all and re do all.

Satyam Shah
  • 51
  • 1
  • 1
  • 5

3 Answers3

7

I think that you don't stage the files before committing.

You can decide what files you want to commit and what files you don't want to commit.

By default, files are installed and won't be committed.

In visual studio code, you can stage changes in the git view using the + button:

Image of staging in VSC

After that, you should be able to commit and push the stages files.

dan1st
  • 12,568
  • 8
  • 34
  • 67
  • 2
    In the Visual Studio Code settings there seems to be a settings for "Enable smart commit" ("Commit all changes when there are no staged changes"). This way you can automatically commit all without staging the files separately. Saved me some clicks. – Juhana Pietari Lehtiniemi Nov 04 '20 at 10:50
0

Try Connecting your Git to your Github( or any Version Control website ),

  1. Create your Github repository were to want to push... Then in your local repository after committing.
  2. Add the Github Url where you want to push your local repository.
    git remote add origin remote <repository URL>
  3. Then push your local repository to your github:
    git push origin master

It may also happen that there are multiple remote-URLs: Instead of removing and re-adding, you can do this:
git remote set-url origin git://new.url.here and again run the commands 2,3

-1

Just ran into this problem setting up a new computer. For me, it turns out that I forgot to SAVE the files before committing them. On VSCode a lot of people click auto save which saves you the hassle, but if you don't have autosave on, remember to save the files you've changed then commit them!

  • related: [Why don't other programs see the changes I made to a file in VS Code until I save those changes?](/q/76984829/) – starball Aug 26 '23 at 22:15