Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT-SVN clone command executes without errors but the local master branch is missing

Tags:

git

svn

git-svn

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

like image 711
Mikael Koskinen Avatar asked Jul 23 '10 12:07

Mikael Koskinen


People also ask

How do I clone a local repository in SVN?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

What does git SVN clone do?

The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.

Can you use git and SVN together?

git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.


2 Answers

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

like image 153
Mikael Koskinen Avatar answered Sep 20 '22 00:09

Mikael Koskinen


Looks all correct to me. Is the result the same if you do the following:

git svn clone --username myUsername https://localhost:8443/svn/projects/ gitFolder

like image 24
turingmachine Avatar answered Sep 20 '22 00:09

turingmachine