[英]How to push my edits of a cloned Github repo to my own repo?
I cloned an existing Github repo, then created a new repo on my own account, did git remote add other <my-new-repo-URL>
, and git push -u other master
.我克隆了一个现有的 Github 存储库,然后在我自己的帐户上创建了一个新的存储库,是否git remote add other <my-new-repo-URL>
和git push -u other master
。 What appears when I look at the new pushed project on Github is a copy of the project that I pulled, without any of the edits I added.当我在 Github 上查看新推送的项目时,出现的是我拉取的项目的副本,没有我添加的任何编辑。 Does anyone know why this would be happening?有谁知道为什么会发生这种情况?
You did not mention the steps you did to " commit everything " .你没有提到你为“提交一切”所做的步骤。
Make sure that you did indeed commit your changes before push
-ing to other
.确保在push
送到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
Make sure also that you are committing on the correct branch.还要确保您在正确的分支上提交。 Maybe you committed on a different branch, but you are only pushing the master
branch to the other
repo.也许你在不同的分支上提交了,但你只是将master
分支推送到other
repo。
You can try push
-ing a different branch or --all
instead.您可以尝试push
-ing 一个不同的分支或--all
代替。
$ git branch
$ git remote add other <new-repo-url>
$ git push other --all
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.