Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning git repository from svn repository, results in file-less, remote-branch-less git repo

Working SVN repo

I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.

Checking it out works fine:

tchalvak:~/test/svn-test$  svn checkout --username=myUsernameHere http://www.url.to/project/here/charityweb/ A    charityweb/README Checked out revision 1. 

Failed git-svn clone of svn repo

When I try to clone the repository in git, the first step shows no errors...

tchalvak:~/test$  git svn clone -s --username=myUserNameHere http://www.url.to/project/here/charityweb/ Initialized empty Git repository in /home/tchalvak/test/charityweb/.git/ Authentication realm: <http://www.url.to/project/here:80> Charity Web Password for 'myUserNameHere':  

...but results in a useless folder, containing no files, no branches, and no commits:

tchalvak:~/test$ ls charityweb tchalvak:~/test$ cd charityweb/ tchalvak:~/test/charityweb$ ls tchalvak:~/test/charityweb$ ls -al total 12 drwxr-xr-x 3 tchalvak tchalvak 4096 2010-04-02 13:46 . drwxr-xr-x 4 tchalvak tchalvak 4096 2010-04-02 13:46 .. drwxr-xr-x 8 tchalvak tchalvak 4096 2010-04-02 13:47 .git tchalvak:~/test/charityweb$ git branch -av tchalvak:~/test/charityweb$ git status # On branch master # # Initial commit # nothing to commit (create/copy files and use "git add" to track) tchalvak:~/test/charityweb$ git fetch fatal: Where do you want to fetch from today? tchalvak:~/test/charityweb$ git rebase origin/master fatal: bad revision 'HEAD' fatal: Needed a single revision invalid upstream origin/master tchalvak:~/test/charityweb$ git log fatal: bad default revision 'HEAD' 

How do I get something I can commit back to? I expect I'm doing something wrong in this process, but what?

like image 653
Kzqai Avatar asked Apr 02 '10 18:04

Kzqai


People also ask

How do I clone a SVN repository?

# 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 ...

Does git clone get all remote branches?

git clone downloads all remote branches but still considers them "remote", even though the files are located in your new repository. There's one exception to this, which is that the cloning process creates a local branch called "master" from the remote branch called "master".

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 convert SVN to git?

The high-level workflow for migrating from SVN to Git is as follows: Prepare a migration environment. Convert the source SVN repository to a local Git repository. (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN.


1 Answers

You used the -s option to git svn clone, but from your example, it doesn't appear that your Subversion repository is using the standard layout (i.e., trunk, branches, and tags directories at the repository root).

If that's the case, clone without -s.

like image 112
Greg Bacon Avatar answered Sep 28 '22 13:09

Greg Bacon