git: 无法将文件添加到 github
git: Can't add files to github
我发现了一些类似的问题。但是我找不到解决方案。
我使用以下方法将包含文件和子文件夹的文件夹添加到我的本地存储库:
git add .
然后:
git commit -m "comment"
我得到:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
问题是,我找不到 github 上的文件。有什么想法吗?
编辑:
git push -u git@github.com:kamekame/wolke master
给出:
To git@github.com:kamekame/wolke
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:kamekame/wolke'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方案:
git remote -v
给我:
origin git@github.com:kamekame/alpha.git (fetch)
origin git@github.com:kamekame/alpha.git (push)
这和我的推送地址不一样 kamekame/wolke!
您需要设置本地存储库以将上游推送到您的 github 存储库。
来自:https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line
您接下来的步骤是:
# create repo via github ui or github cli
# add github as the origin
git remote add origin remote_repository_URL
# push changes to repo
git push origin master
我发现了一些类似的问题。但是我找不到解决方案。
我使用以下方法将包含文件和子文件夹的文件夹添加到我的本地存储库:
git add .
然后:
git commit -m "comment"
我得到:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
问题是,我找不到 github 上的文件。有什么想法吗?
编辑:
git push -u git@github.com:kamekame/wolke master
给出:
To git@github.com:kamekame/wolke
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:kamekame/wolke'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方案:
git remote -v
给我:
origin git@github.com:kamekame/alpha.git (fetch)
origin git@github.com:kamekame/alpha.git (push)
这和我的推送地址不一样 kamekame/wolke!
您需要设置本地存储库以将上游推送到您的 github 存储库。 来自:https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line
您接下来的步骤是:
# create repo via github ui or github cli
# add github as the origin
git remote add origin remote_repository_URL
# push changes to repo
git push origin master