Git推送问题 [英] Git Push Issues

查看:182
本文介绍了Git推送问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我从github刚刚克隆的存储库。地址是 git://github.com/JoshClose/CsvHelper.git ,如果你想试试这个。我正在使用tortoisegit,但是如果需要的话,会使用命令行来解决这个问题(我可能需要我的手为此做一点)。



日志看起来像这样:

  * 0.11 
|
| *主产地/ HEAD产地/主人0.10
| |
| -
|
* 0.9.1

我很确定在做0.10的更改后,我没有将分支切换回0.9.1并且工作在0.11,但它看起来像。



我想要做的是删除0.11,切换到0.10,对我需要的0.11进行更改,然后推送到github。我想这些变化很小,但我可以合并这两个。



更改后,日志如下所示:

  * (这没有标签/分支名称)
|
*主产地/ HEAD产地/主人0.10
|
* 0.9

为什么没有主人切换到我的新更改?



当我这样做并尝试推送到github,或者进行任何更改并推送时,我收到错误消息:

  git.exe pushorigin(no branch)

错误:src refspec(no不匹配任何
错误:src refspec分支)不匹配任何。
错误:无法将某些参考文献推送到'git@github.com:JoshClose / CsvHelper.git'

我尝试了拉他们解决这个问题的方法,但那并不奏效。 Pulling说,一切都是最新的。我也尝试过使用--force,但得到相同的错误。



我认为主设备没有设置新的更改会出现问题。当我推送到github时,我所在的分支说(不分支)。



我能做些什么来解决这个问题?我准备好删除存储库并重新开始。

解决方案

您必须直接签出标签或SHA1提交,在此过程中 分离的HEAD

所有的更新/修改发生在这个未命名的分支引用中,称为分离的HEAD。

 在推送之前,您应该创建(声明)一个分支,或者合并master以及HEAD(快进)合并。 git branch tmp 
git checkout master
git merge tmp#fast-forward master

这应该给你:

  *(master,tmp)
|
* origin / HEAD(origin / master)0.10
|
* 0.9


I have a repository that I freshly cloned from github. The address is git://github.com/JoshClose/CsvHelper.git if you want to try this out. I am using tortoisegit, but will use the command line to fix this if need be (I might need my hand held a little for that).

The log looks like this:

*   0.11
|
| * master origin/HEAD origin/master 0.10
| |
|-
|
*   0.9.1

I'm pretty sure after doing the changes for 0.10, that I didn't switch the branch back to 0.9.1 and work on 0.11, but that it was it looks like.

What I want to do is remove 0.11, switch to 0.10, make the changes for 0.11 that I need, then push to github. The changes are small, but I could merge the two, I suppose.

After the changes, the log looks like this:

* (this has no label/branch name)
|
* master origin/HEAD origin/master 0.10
|
* 0.9

Why didn't master get switched to my new changes?

When I do this and try pushing to github, or make any changes and push, I get the error:

git.exe push    "origin" (no branch)

error: src refspec (no does not match any.
error: src refspec branch) does not match any.
error: failed to push some refs to 'git@github.com:JoshClose/CsvHelper.git'

I've tried the pull them push method of fixing this issue, but that didn't work. Pulling says that everything is up to date. I've tried doing a --force also, but get the same error.

I think there is a problem with master not being set with my new changes. When I go to push to github, the branch I'm on says (no branch).

What can I do to fix this? I'm ready to just delete the repository and start over.

解决方案

You must have checked out directly a tag or a SHA1 commit, making in the process a detached HEAD.
All your updates/modifications took place in this unnamed branch reference by said "detached HEAD".

Before pushing, you should create (declare) a branch, or merging master with HEAD (fast forward) merge.

git branch tmp
git checkout master 
git merge tmp # fast-forward master

That should give you:

* (master,tmp)
|
* origin/HEAD (origin/master) 0.10
|
* 0.9

这篇关于Git推送问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆