Git push new branch而不指定远程名称会给出refspec错误

时间:2013-12-09 03:24:21

标签: git github

我正在尝试别名推送命令,所以我不必一直输入我的分支名称,而且我在这一步停滞不前:
Git push new local branch to remote, without having to specify name

此命令对我不起作用。我明白了:

$ git push origin -u head

error: src refspec head does not match any.
error: failed to push some refs to 'git@github.com:hurtstotouchfire/repo.git'

这个分支是通过克隆到repo中创建的,然后使用git checkout -b创建新分支,进行提交,然后使用上面的push命令。是否需要使用此命令进行配置?

1 个答案:

答案 0 :(得分:1)

git push origin -u HEAD

HEAD是有效的参考号,head不是。