当试图推出全新的遥控器时,全新的git repo都说“一切都是最新的”

时间:2011-10-18 22:42:41

标签: git push

我是个新手。我刚刚用4个新文件test1 test2 test3 test4创建了一个新项目。然后我所做的就是以下内容:

$ git init
$ git add .
$ git commit -m "VERY 1st commit"

就这么简单。

然后我添加了一个远程仓库也是我刚刚在bitbucket.org创建的一个全新的仓库

$ git remote add rakspace http://syedrakib@bitbucket.org/syedrakib/mysamplegit
$ git push rakspace

你可以告诉它全新的工作空间被推入一个全新的回购。它返回:

  

一切都是最新的

我在这里做错了什么?很明显,远程仓库的源文件没有得到更新。

编辑:我的本地仓库中有2个分支: * master * * new_branch *

3 个答案:

答案 0 :(得分:5)

git push的默认行为是推送“匹配”分支。这意味着你身边的任何一个分支在另一边都有一个名为相同的分支的分支被推动。在一个全新的存储库中,没有分支。因此没有分支匹配。您可以使用git push <remote name> <branch name>在远程上创建名称与您的分支匹配的分支。在您的情况下:git push rakspace master

您可以在git config documentation中查找push.default,了解并更改推送设置。

答案 1 :(得分:1)

尝试git push rakspace master。您认为需要指定要推送的分支。

如果那不是问题那么,我想知道你是否真的通过git add .向存储库添加了什么?

尝试

touch TEST
git add .
git commit -m "Committing a file named TEST."
git push rakspace master

答案 2 :(得分:0)

在网上多个地方进行了大量讨论后,我认为首次推出清洁新回购的解决方案是

git push rakspace --all

从那时起,推拉式工作正常。有多么有趣?? !!!

相关问题