我克隆了一个现有的 Github 存储库,然后在我自己的帐户上创建了一个新的存储库,做了git remote add other <my-new-repo-URL>
,然后git push -u other master
。当我在 Github 上查看新推送的项目时,出现的是我拉取的项目的副本,没有我添加的任何编辑。有谁知道为什么会这样?
你没有提到你为">提交所有内容"所做的步骤。
确保在push
-ing 之前确实提交了更改other
。
$ git clone <old-repo-url>
$ cd old-repo
$ (add/edit files)
$ git add .
$ git status
$ git commit -m "Edited some files"
$ git status
On branch master
Your branch is ahead of 'origin/master' by X commits.
(use "git push" to publish your local commits)
...
$ git remote add other <new-repo-url>
$ git push -u other master
还要确保您在正确的分支上提交。也许您在不同的分支上提交,但您只是将master
分支推送到other
存储库。
您可以尝试改用其他分支或--all
push
。
$ git branch
$ git remote add other <new-repo-url>
$ git push other --all