GIT - 推送到(GitHub)原始主节点什么都不做

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6195973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:03:31  来源:igfitidea点击:

GIT - pushing to (GitHub) origin master does nothing

gitgithub

提问by Nippysaurus

I have forked someone's GIT repository:

我已经分叉了某人的 GIT 存储库:

https://github.com/nippysaurus/toodledo-objc

Cloned it to my local machine, showing the origin with the following information:

将它克隆到我的本地机器,显示具有以下信息的来源:

* remote origin
  Fetch URL: https://[email protected]/nippysaurus/toodledo-objc.git
  Push  URL: https://[email protected]/nippysaurus/toodledo-objc.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

When I push my changes to "origin master" git prints "everything up to date", but nothing it updated in my GitHub repo.

当我将更改推送到“origin master”时,git 会打印“所有最新内容”,但在我的 GitHub 存储库中没有任何更新。

What is going on here?

这里发生了什么?

EDIT:

编辑:

Someone is suggesting that I check thay the files were actually commited... the files were commited, I assure you.

有人建议我检查文件是否确实已提交……文件已提交,我向您保证。

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f
Author: nippysaurus <[email protected]>
Date:   Wed Jun 1 13:19:14 2011 +1000

    updated readme

This is the file that was updated:

这是更新的文件:

commit 0d3a21616d82c8e5a89baaf85d745fc2cfdf614f
Author: nippysaurus <[email protected]>
Date:   Wed Jun 1 13:19:14 2011 +1000

    updated readme

diff --git a/README.mdown b/README.mdown
index fb8ee14..a71aa57 100644
--- a/README.mdown
+++ b/README.mdown
@@ -3,7 +3,7 @@ toodledo-objc

 An _unofficial_ toodledo-API implementation in ObjectiveC.

-This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic
+This library currently uses [version 1.0 of the API](http://www.toodledo.com/info/api_doc.php "Toodledo API 1.0 spec") which has been offic

 Supported:

Also, I can see that the local version of the file is very different to the version on GitHub, the changes are definately being added to my local repo, but are not being pushed to the remote repo.

此外,我可以看到该文件的本地版本与 GitHub 上的版本非常不同,这些更改肯定会添加到我的本地存储库中,但并未推送到远程存储库。

回答by ralphtheninja

It might be the case that you are on another branch than the master branch, then type:

可能是您在 master 分支之外的另一个分支上,然后键入:

git push origin HEAD:master

so git understands that you want to push up current HEAD and not the master branch.

所以 git 明白你想推上当前的 HEAD 而不是主分支。

回答by swordfish

When it says Up to date it means your local repository and your remote repository are one and the same, that is you have not made any changes to your local repo that needs to be pushed to the remote repo.

当它显示为最新时,这意味着您的本地存储库和远程存储库是一回事,也就是说,您尚未对需要推送到远程存储库的本地存储库进行任何更改。

If you have indeed changed the files then you must have forgot to commit it.

如果您确实更改了文件,那么您必须忘记提交它。

If you had created new files then you must add it. To add files use

如果您创建了新文件,则必须添加它。添加文件使用

git add .

then to commit all the edited files use

然后提交所有编辑过的文件使用

git commit -am "Commit message"

then do

然后做

git push origin master

回答by Safwan

Use this commands. Suppose test.md is the new file you created and you want to push it with the message "Testing"

使用此命令。假设 test.md 是您创建的新文件,并且您想使用“Testing”消息推送它

$ git add test.md
$ git commit -a -m "Testing"
$ git push origin master