Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: pathspec 'master' did not match any file(s) known to git #306

Open
asthagangwar3 opened this issue Jan 13, 2022 · 7 comments
Open

Comments

@asthagangwar3
Copy link

using svn2git for migrating svn to git but getting below error,

\MYProject\Demo>svn2git https://shwetakhai-w10.cybage.com:8443/svn/SVN2GIT/ --authors authors.txt -v
Running command: git svn init --prefix=svn/ --no-metadata --trunk='trunk' --tags='tags' --branches='branches' https://shwetakhai-w10.cybage.com:8443/svn/SVN2GIT/
Initialized empty Git repository in D:/MYProject/Demo/.git/
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

@ghost
Copy link

ghost commented Mar 17, 2022

Had the same issue and svn2git didn't work for me at all.

I managed to migrate using the steps outlined here
https://gist.github.com/leftclickben/322b7a3042cbe97ed2af

@swaroopbekal
Copy link

Looks like git svn fetch failed. You can try to figure out why it failed by running it manually.

@ams-tschoening
Copy link

Current versions of GIT don't create a master branch anymore by default, but a main one. It might simply happen that your tooling is recent enough that svn2git doesn't support this change anymore.

https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/

@zedseven
Copy link

zedseven commented Oct 9, 2022

To add to the comment above, you may be able to get around this by running git config --global init.defaultBranch master and re-running svn2git. (make sure to change it back to main afterwards if that's something you care about)

I'm attempting this currently, but it'll be another 16 hours before I know if it was successful, since this error occurs after the git svn fetch. :)

@zedseven
Copy link

zedseven commented Oct 9, 2022

It doesn't seem like my previous suggestion worked (after another ~16 hours).

I forked this repo and changed it so that it looks for main now instead of master – I'm going to try that, and anyone else is welcome to try it too: https://github.com/zedseven/svn2git

@JokaHD
Copy link

JokaHD commented Oct 13, 2022

Hi @zedseven,

I've test your forked repo on my svn repo successfully after I update git to the latest version and add --nobranches .
Thanks!!

@skull-squadron
Copy link

skull-squadron commented Jan 14, 2024

Instead of getting into default branch name holy wars or a compatibility excretion contest by making a fragile assumption, I've found this pattern to work without modifying svn2git:

mkdir {{your_repo}}
cd {{your_repo}}
git init -b master
svn2git ....

This has the advantage of not modifying git global defaults or changing svn2git which would require multiple layers of up- and downstream release processes to arrive as a standard system package. A more robust fix would be for svn2git to check which branch git created rather than assuming it because it will break in environments where the default branch is something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants