GIT-SVN克隆命令执行没有错误,但本地主分支丢失 [英] GIT-SVN clone command executes without errors but the local master branch is missing

查看:170
本文介绍了GIT-SVN克隆命令执行没有错误,但本地主分支丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GIT-SVN,但我在开始时遇到问题。我可以在没有任何错误的情况下克隆svn-repository(或者使用git svn init,然后使用git svn fetch),但是在命令停止处理之后,git仓库是空的,并且没有本地master分支。



我的svn仓库位于这里:

https:// localhost:8443 / svn / projects



项目文件夹的结构如下所示:

  / projectA / trunk 
/ projectA / branches
/ projectA / tags
$ b $ / projectB / trunk
/ projectB / branches
/ projectB / tags

(note,branches and tags-文件夹是空的,trunk-folder包含文件)。

我想克隆projectA,所以我使用这个命令:

  git svn clone --username myUsername https:// localhost:8443 / svn / projects / gitFolder --trunk projectA / trunk --branches projectA / branches --tags projectA / tags 

处理大约需要10分钟,并将所有文件名输出到屏幕。最后一行看起来像这样:

  r233 = 2bfb031dda74e0ae8340688892197d647729b256(refs / remotes / trunk)

现在,如果我切换到gitFolder并输入git log,我会得到:
致命错误:缺省修订版本'HEAD'。



git branches -a 报告:


遥控器/主干。

gitFolder中有一个.git文件夹,但没有别的。我也尝试过到 git svn init git svn fetch ,而不是 git svn克隆但最终结果是相同的。



任何想法是怎么回事?

更新:

刚刚意识到最后一行(r233 = 2bf ...)必须指向修订号。所以最后处理的svn修订版本是233.我多次重新测试了这个版本,并且git-svn clone始终在修订版本233之后停止。问题是原始svn存储库包含超过10100个修订版本。我不确定为什么git-svn在应用之前停止,因为没有任何错误或警告。是否有一个日志文件可以提供更多的线索?



另一个更新:

我能够解决我的问题。这是由VisualSVN(版本2.1.3)和Msysgit(版本1.7.0.2-preview20100309)之间的通信问题引起的。看起来,在某些时候,git-svn只是失去了与VisualSVN服务器的连接,并且未能显示错误并且关闭。从http协议切换到svn协议解决了这个问题。

使用svn协议和VisualSVN很容易:


  1. 转至VisualSVN的bin文件夹

  2. 键入svnserve --daemon

您可以使用TortoiseSVN并将它指向您的存储库来检查一切正常:svn:// localhost / repositories / myProject

解决方案

我能解决我的问题。这是由VisualSVN(版本2.1.3)和Msysgit(版本1.7.0.2-preview20100309)之间的通信问题引起的。看起来,在某些时候,git-svn只是失去了与VisualSVN服务器的连接,并且未能显示错误并且关闭。从http协议切换到svn协议解决了这个问题。

使用svn协议和VisualSVN很容易:

转到VisualSVN
的bin文件夹键入svnserve --daemon
您可以使用TortoiseSVN并将它指向您的存储库来检查一切正常:svn:// localhost /存储库/ myProject


I'm trying to use GIT-SVN but I'm having problems getting things started. I can clone the svn-repository (or use git svn init and then git svn fetch) without any errors but after the command stops processing, the git repository is empty and there's no local master branch.

My svn repository is located in here:

https://localhost:8443/svn/projects

And the project folder is structured like this:

/projectA/trunk
/projectA/branches
/projectA/tags

/projectB/trunk
/projectB/branches
/projectB/tags

(note, branches and tags-folders are empty, trunk-folder contains files).

I'm trying to clone the projectA so I used this command:

git svn clone --username myUsername https://localhost:8443/svn/projects/ gitFolder --trunk projectA/trunk --branches projectA/branches --tags projectA/tags

The processing takes around 10 minutes and it outputs all the filenames to the screen. Last line looks like this:

r233 = 2bfb031dda74e0ae8340688892197d647729b256 (refs/remotes/trunk)

Now if I switch to gitFolder and type git log, I get: fatal: bad default revision 'HEAD'.

git branches -a reports this:

remotes/trunk.

There's a .git folder in gitFolder but nothing else. I've also tried to to git svn init and git svn fetch instead of git svn clone but the end result is same.

Any ideas what's going on? Thanks in advance.

Update:

Just realized that the last line (r233 = 2bf...) must point to the revision number. So the last handled svn revision is 233. I've retested this multiple times and the git-svn clone always stops after the revision 233. The problem is that the original svn repository contains more than 10100 revisions. I'm not sure why git-svn is stopping before it should because there isn't any errors or warnings. Is there a log file somewhere which could give more clues?

Another update:

I was able to solve my problem. It was caused by the communications problems between the VisualSVN (version 2.1.3) and the Msysgit (version 1.7.0.2-preview20100309). It seems that at some point git-svn just loses the connection to the VisualSVN-server and fails to show the error and just closes down. Switching from http-protocol to svn-protocol fixed the problem.

Using svn-protocol with VisualSVN is quite easy:

  1. Go to the bin-folder of the VisualSVN
  2. Type "svnserve --daemon"

You can check that everything works by using the TortoiseSVN and pointing it to your repository: svn://localhost/repositories/myProject

解决方案

I was able to solve my problem. It was caused by the communications problems between the VisualSVN (version 2.1.3) and the Msysgit (version 1.7.0.2-preview20100309). It seems that at some point git-svn just loses the connection to the VisualSVN-server and fails to show the error and just closes down. Switching from http-protocol to svn-protocol fixed the problem.

Using svn-protocol with VisualSVN is quite easy:

Go to the bin-folder of the VisualSVN Type "svnserve --daemon" You can check that everything works by using the TortoiseSVN and pointing it to your repository: svn://localhost/repositories/myProject

这篇关于GIT-SVN克隆命令执行没有错误,但本地主分支丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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