Skip to content
Advertisement

Why not able to push the new added files on remote repository?

I am new to Git. I have recently created a repository and uploaded a folder in it using the following sequence of commands:

$ git init
$ git add <file name>
$ git commit -m "some comment"
$ git branch -M main
$ git remote add origin <url>
$ git push -u origin main

This was my first time when I uploaded the files to this repository. Now I am trying to upload more files to this repository using the following commands:

$ git add <file name>
$ git commit -m "some comment"
$ git branch -M main
$ git push -u origin main

But, I am getting the following information:

Branch 'main' set up to track remote branch 'main' from 'origin'.
Everything up-to-date

Why is it so? How can I upload more files on my repository using git in the command line?
Please resolve it.
Thank you!

Advertisement

Answer

I am not sure what is causing you’re specific problem here, but i think you are not following the correct workflow. These are the steps you should follow:

  1. Type git branch and ensure that you are on the main branch (if not do git checkout main)

  2. Then do:

    git add <file>
    git commit -m "comment"
    git push -u origin main
    

Follow this flow everytime you want to push to this branch and you should have no issues.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement