用svn元数据克隆一个git-svn仓库 [英] Cloning a git-svn repository with svn metadata

查看:122
本文介绍了用svn元数据克隆一个git-svn仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 git-svn clone svn:// url / trunk --stdlayout 克隆了我的主存储库。现在我想用svn元数据克隆存储库。所以我可以将 git-svn rebase 它传递给主服务器。



请注意,我不会我不想在两个 git-svn 克隆之间推送提交,我只是想添加所有的 git-svn 元数据到新克隆的存储库,以便新的克隆也能够与主要的subversion服务器进行通信。

文档中。你应该做的是:

  git config --replace-all remote.origin.fetch'+ refs / remotes / *: refs / remotes / *'
git fetch

取得 svn 元分支。然后你就可以在不提取所有东西的情况下 git-svn rebase




引用文档:


最初的git svn clone可能会花费相当多的时间(特别是对于大
Subversion版本库)。如果多个
的人(或者一个人有多个
的机器)想要使用git svn到
与相同的Subversion
库交互,那么可以执行初始git
svn克隆到服务器上的存储库
并让每个人用git clone克隆该
存储库:



#在服务器上执行初始导入
ssh servercd / pub&&&git svn clone http://svn.example.com/project
#克隆本地 - 确保refs / remotes / space匹配服务器
mkdir项目
cd项目
git init
git远程添加原始服务器:/ pub / project
混帐配置--replace-所有remote.origin.fetch '+参/遥控器/ *:参/遥控器/ *'
混帐取
#防止读取/从远程服务器的git拉在未来,
#我们只想使用git svn进行未来更新
git config --remove-section remote.origin
#创建一个本地分支其中一个分支的只是获取
git的结帐-b主FETCH_HEAD
#初始化混帐SVN本地(一定要使用相同的URL和-T / -b / -t选项是在服务器上使用)
git svn init http://svn.example.com/project
#从Subversion提取最新的更改
git svn rebase


I've cloned my main repository with git-svn clone svn://url/trunk --stdlayout. Now I want to clone the repository, with the svn meta data. So that I'll be able to git-svn rebase it to the main server.

Note, I don't want to push commits between two git-svn clones, I simply want to add all the git-svn metadata to the newly cloned repository, so that the new clone will be able to communicate with the main subversion server as well.

解决方案

It's in the docs. What you should do is:

git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch

to fetch the svn meta-branches. Then you'll be able to git-svn rebase without fetching everything from scratch.


Quoting from the docs:

The initial git svn clone can be quite time-consuming (especially for large Subversion repositories). If multiple people (or one person with multiple machines) want to use git svn to interact with the same Subversion repository, you can do the initial git svn clone to a repository on a server and have each person clone that repository with git clone:

# Do the initial import on a server
        ssh server "cd /pub && git svn clone http://svn.example.com/project
# Clone locally - make sure the refs/remotes/ space matches the server
        mkdir project
        cd project
        git init
        git remote add origin server:/pub/project
        git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
        git fetch
# Prevent fetch/pull from remote git server in the future,
# we only want to use git svn for future updates
        git config --remove-section remote.origin
# Create a local branch from one of the branches just fetched
        git checkout -b master FETCH_HEAD
# Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
        git svn init http://svn.example.com/project
# Pull the latest changes from Subversion
        git svn rebase

这篇关于用svn元数据克隆一个git-svn仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆