用svn元数据克隆一个git

用svn元数据克隆一个git

本文介绍了用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




引用文档:



#在服务器上执行初始导入
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:

# 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仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 23:40