nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

command failed - error: pathspec 'master' did not match any file(s) known to git. #230

Open jaydipr opened 7 years ago

jaydipr commented 7 years ago

This might be a quick one but I tried couple of options and nothing seems to work. My SVN repo URL is correct too, it's just above the trunk. Appreciate any help/direction. Let me know if you need any more info. I am trying this on Win7 64-bit machine.

Executed command - svn2git https://xyz.xyz.com/svn/svnrepo/ --verbose --authors authors.txt

console output - Running command: git svn init --prefix=svn/ --no-metadata --trunk='trunk' --tags ='tags' --branches='branches' https://xyz.xyz.com/svn/svnrepo/ Running command: git config --local --get user.name Running command: git config --local svn.authorsfile authors.txt Running command: git svn fetch Running command: git branch -l --no-color Running command: git branch -r --no-color Running command: git config --local --get user.name Running command: git config --local --get user.email Running command: git checkout -f master error: pathspec 'master' did not match any file(s) known to git. command failed: git checkout -f master

Thanks!

gonzaloluna commented 7 years ago

Same happens to me running with options --revision 418:447 --authors authors-transform.txt --notags --nobranches --trunk /blabla

x9t9 commented 7 years ago

For me it worked with --notags , --nobranches , --notrunk

kevinwong1983 commented 7 years ago

Same problem here. --notags , --nobranches , --notrunk did not help

Also tried: - svn2git https://xyz.xyz.com/svn --trunk /svnrepopath/trunk --tags /svnrepopath/tags --banches /svnrepopath/branches ... no luck

Working at it for a while but nothing seems to work. I have removed the .git folder between every try. please share if I you have solved this issue.

x9t9 commented 7 years ago

@kevinwong1983 is that local or remote ? If local do you have the svnserve ( or similar ) installed correctly ?

Also.. Did you setup the authors.txt author mapping ? Did you tried to give only the root path ? ( e.g. .../svnrepopath/ )

mvijay2050 commented 7 years ago

same problem I am facing too, tried multiple options, notrags, nobranch, with author file without author file, but none worked so far

jaydipr commented 7 years ago

@x9t9 yes, it works like that but we have standard layout with branches, tags and trunk.

I couldn't use svn2git but i tried following 2 options and both worked for me.

For complete SVN repo migration - https://www.atlassian.com/git/tutorials/migrating-overview For selective branches/tags - http://www.janosgyerik.com/practical-tips-for-using-git-with-large-subversion-repositories/

davidkeaveny commented 7 years ago

I ran the following:

> md Repos
> cd Repos
> md Database
> cd Database
> svn2git svn://my.svn.server/Database --authors ..\authors.txt --no-minimize-url
Initialized empty Git repository in D:/Repos/Database/.git/
command failed:
git checkout -f master

> git checkout -f master
error: pathspec 'master' did not match any file(s) known to git.

The .git folder was created in \Repos\Database, but total size was only 28KB with 16 files in 14 folders. I have multiple projects in the repository, each of which uses standard layout (this run was obviously for the database project, which I know contains hundreds of commits, with hundreds of files - one file per database object in a multi-gigabyte database).

svnserve is installed correctly and running without problem, as I am running our current TeamCity builds from it.

awhitford commented 7 years ago

I am struggling with this too. I have spent a day attempting various permutations and have been unsuccessful to get svn2git working -- it keeps running into the git checkout -f master failure.

I was able to get a vanilla git svn clone working. When comparing that experience to svn2git, I seem to have narrowed the problem down to the prefix switch ( --prefix=svn/). If I run git svn init without specifying prefix, then I can run git svn fetch successfully.

In my case, my URL is like: http://host/svn/repo/project/trunk -- where the project follows the standard layout. The prefix is computed as: --prefix=svn/

Why is that prefix important?

I should mention that I am using git version 2.12.2.windows.1 on a Windows 10 (64-bit) machine with svn version 1.8.13 installed and ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32].

awhitford commented 7 years ago

I am starting to wonder if #241 is the root cause since I was successful with the --stdlayout option.

awhitford commented 7 years ago

I am now 100% convinced that my inability to run this successfully on Windows was due to #241. This ran fine on Linux, and I can witness the tick issue.

ShaunCollege commented 6 years ago

Year later, no answer, huh?

davidkeaveny commented 6 years ago

In the end I gave up, and just committed the most recent version in SVN to Git; if people wanted the history prior to that, then the old SVN repo was left running. TBH I don't think anyone has...

jooheazy commented 6 years ago

Hi guy's, I did this to solve this problem in windows SVN repo

https://stackoverflow.com/questions/41230248/svn2git-command-failed-error-pathspec-master-did-not-match-any-files-kn

Removing quotes around #{trunk}, #{tag} and #{branch} from migration.rb file.

schifazl commented 5 years ago

I confirm that the solution provided by @jooheazy works flawlessly. You saved me, thanks!

sayantandas commented 5 years ago

I found another workaround.

  1. create a blank git repository with the same name as the svn and do git clone
  2. checkout the svn repo
  3. cd into the folder and run svn2git. the error does not show up.

I was able to push all the code to git and also the corresponding tags