将新分支推送到google.com git存储库

时间:2012-07-31 01:12:09

标签: git

从现有的code.google项目开始,并成功推送初始代码。

我在本地副本上创建了一个新分支。我为分支机构提交了更改,现在我想将分支机构推送到code.google repo。我输入这个:

git push origin branch_name -v https://username:password@code.google.com/p/project-name/ 

但是我收到了这个错误

  

致命:refspec的远程部分不是https://username:password@code.google.com/p/project-name/

中的有效名称

3 个答案:

答案 0 :(得分:2)

通常,您不需要指定推送目标的完整URL,因为远程origin已经指向该列表(为列表键入git remote -v)。所以你可能只需要:

git push origin branch_name

答案 1 :(得分:1)

push命令的语法:

git push [ <options> ] <repository> [ <refspec> ]

在最简单的情况下,<options>为空,<repository>通常为origin<refspec>是您当前分支的名称:

git push origin branch_name

这假设您已通过克隆远程存储库或使用origin命令创建了名为git remote add ...的远程数据库。如果尚未配置远程,则可以在命令行上替换URL,如下所示:

git push https://username:password@code.google.com/p/project-name/ branch_name

答案 2 :(得分:0)

在远程服务器上将本地分支推送为新的:

  

git push origin local_branch_name:remote_branch_name_that_will_be_created

相关问题