为什么不能将新添加的文件推送到远程存储库?

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

我是 Git 的新手。我最近创建了一个存储库并使用以下命令序列在其中上传了一个文件夹:

$ 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

这是我第一次将文件上传到此存储库。现在我尝试使用以下命令将更多文件上传到此存储库:

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

但是,我得到以下信息:

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

为什么会这样?如何在命令行中使用 git 将更多文件上传到我的存储库?
请解决。
谢谢!

我不确定是什么导致了您的具体问题,但我认为您没有遵循正确的工作流程。这些是您应该遵循的步骤:

  1. 键入 git 分支并确保您在主分支上(如果不在 git checkout main)

  2. 然后做:

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

每次你想推送到这个分支时都遵循这个流程,你应该没有问题。