문제

I've got a git repository cloned from an external SVN repository through git svn clone. On a separate machine, I'd like to get this clone set up again, so I can update the git repository with recent SVN changes. How do I do this?

It seems using git svn clone or git svn init creates an empty repository, and git svn fetch uses a predefined URL. I don't want to have to reset my Git repository - I just want to pull the existing remote, re-link it to the same SVN, and continue with the git svn rebase to update Git with recent SVN changes.

도움이 되었습니까?

해결책 3

You can re-establish a git svn clone just by running the same commands you used to initialise the remote Git in the first place (but you might need to ensure you use the same --prefix in the git svn clone). It looks like Git keeps track of SVN metadata in the Git commit messages (git-svn-id:) to prevent duplicates.

That is:

  1. git svn clone -s https://openclerk.googlecode.com/svn/ openclerk -A svn-authors.txt --prefix "" (the empty prefix is because the original Git repository used an empty prefix too)
  2. git remote add origin https://github.com/soundasleep/openclerk.git
  3. git branch --set-upstream-to=origin/master master
  4. git pull
  5. Carry on with git push, git svn rebase, git svn dcommit as necessary

다른 팁

If my svn repo did not follow standard layout this is what worked for me was:

git clone <git-repo>
cd <git-repo>
git svn init <svn-repo>
git config svn.authorsfile <your-authors-file>.txt
git svn fetch
(Optional) git branch -a  (should see a remotes/git-svn branch)
git checkout -b <some-branch-name> git-svn 
git checkout master
git rebase <some-branch-name>
#Now you can use "git svn rebase" etc.
git rebase origin/master
# Now you can push and pull

If my svn repo did follow the standard layout jevon's answer worked.

Why not copy your local repo files to the second machine.

$ scp /path/to/first/repo user@second_machine_host:/path/to/second/repo

or

$ rsync -avz /path/to/first/repo user@second_machine_host:/path/to/second/repo

or if you use Windows, you can just copy repo directory to the second machine by Remote Desktop, see here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top