我试图将我的源代码部署到Github上.然后,我首先将github源添加到远程源,如下所示:
$ git remote add origin git@github.com:user_name/foo_bar.git*
Run Code Online (Sandbox Code Playgroud)
然后,我尝试运行"git push"命令将我的源代码上传到我的远程github帐户,如下所示.
$ git push
Enter passphrase for key '/c/Users/mylaptop/.ssh/id_rsa':
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git@github.com:user_name/foo_bar.git'
Run Code Online (Sandbox Code Playgroud)
正如我从railstutorial.org上学到的,我知道如果我第一次使用"git push",它将返回一个错误,期望我指定"origin master"参数.但是对于下一次和后来的时间,我只能启动"git push",它会优雅地为我工作.这是什么原因?因为我认为默认情况下命令总是指分支'master'.
任何明确的解释都会非常感激.
第一次执行时git push,没有名为master on origin的远程分支.
分支存在后,您可以使用git push它,它将链接到远程分支,其名称与您当前所在分支的名称相同.
| 归档时间: |
|
| 查看次数: |
3982 次 |
| 最近记录: |