当使用两个(Git和SVN)存储库时,“无法从工作树历史记录确定上游SVN信息” [英] “Unable to determine upstream SVN information from working tree history” when using two (Git and SVN) repositories

查看:664
本文介绍了当使用两个(Git和SVN)存储库时,“无法从工作树历史记录确定上游SVN信息”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下问题 - 我正在研究基于SVN存储库的Git存储库。我使用 git svn clone path-to-repo 命令克隆SVN存储库,这样我的Git保留了相同的历史记录并且有一个共同的基础。克隆完成后,我使用 git remote add origin path -to-my-git-repo 添加了一个Git远程仓库。然后,我应用了一些更多的提交,并将其仅推送到Git存储库(因此,显然它们没有像SVN中提交的提交那样的 git-svn-id )。每当我做出更改时SVN仓库不会立即更新(相反,它会在每个给定的时间段更新),但我必须保持它与我的项目连接,以便我可以使用其他人的更改来重新绑定我的Git存储库仅提交到SVN存储库。



一切看起来都很棒,我克隆了SVN回购,添加了一个Git远程版本,我可以进行更改,重新绑定,当我需要时,我可以将更改推送到Git或者SVN仓库。



问题是,我需要将这个项目克隆到多个位置。当我克隆Git的时候( git clone path-to-repo target-directory )并且使用 git svn init path-to来添加一个SVN远程仓库-svn-repo --trunk =/命令,我无法使用SVN存储库中的新更改重新整理我的项目。它似乎是连接,因为它要求输入用户名和密码,但是出现无法确定来自工作树历史记录的上游SVN信息错误。顺便说一下, - trunk =./在这里并不是一个错误 - SVN仓库不遵循具有分支,标签和中继的惯例,而是代码直接在基本目录中(或者至少在使用 git svn clone - 文件直接在目标目录中)克隆后,看起来像这样。



克隆SVN仓库以使其工作,并且每次克隆项目时手动添加来自Git的提交不是一种选择。



我在这里做错了什么?我会很感激任何帮助或提示。

解决方案

我多么傻。事实证明,为了执行 git svn rebase ,必须首先执行 git svn fetch 。 p>

I have a following problem - I'm working on a Git repository that's based on a SVN repository. I used git svn clone path-to-repo command to clone the SVN repository so my Git one retains the same history and has a common base. After cloning, I added a Git remote repository using git remote add origin path-to-my-git-repo. Then, I applied some more commits and pushed it to Git repository only (so, obviously they don't have git-svn-id like the commits cloned from SVN). SVN repository won't be updated at once every time I make changes (instead, it will be updated every given period of time), but I have to keep it connected to my project, so I can rebase my Git repository with changes other people commit to SVN repository only.

Everything looked great, I cloned the SVN repo, added a Git remote one, I was able to make changes, rebase and when I need, I could push changes to Git or SVN repository.

The problem is, I need the project cloned on several locations. When I clone the Git one (git clone path-to-repo target-directory) and add a SVN remote repository using git svn init path-to-svn-repo --trunk="/" command, I can't rebase my project with new changes in SVN repository. It seems to be connecting, because it asks for username and password, but gives an "Unable to determine upstream SVN information from working tree history" error. By the way, --trunk="./" is not a mistake here - SVN repository doesn't follow a convention of having branches, tags and trunk, instead the code is directly in the base directory (or at least it looks like this after seeing it cloned using git svn clone - files are directly in the target directory).

Cloning SVN repository to make it work and adding commits from Git one manually every time I clone the project is not an option.

What am I doing wrong here? I'd appreciate any help or hints.

解决方案

How silly of me. Turns out that in order to do a git svn rebase, it's necessary to do a git svn fetch first.

这篇关于当使用两个(Git和SVN)存储库时,“无法从工作树历史记录确定上游SVN信息”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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