git-svn:如何在dcommit上更改SVN用户名



我使用 git svn clone 将 SVN 存储库克隆到 git 存储库中。当时,我在该站点上没有用户名,因此没有使用--username选项clone。由于我现在可以用我的新用户名提交到 SVN 存储库,我想添加该用户名。没有它,dcommit就会失败:

% LANG=C git svn dcommit 
Committing to <THE URL> ...
RA layer request failed: Server sent unexpected return value (405 Method Not Allowed) in response to MKACTIVITY request for '/svn/!svn/act/0ceca4c5-f7b4-4432-94be-0485559a6040' at /usr/lib/git-core/git-svn line 945.

有没有办法告诉 git 一个新的用户名?git-svn 手册似乎没有帮助:只允许在 initbranch 上添加用户名。我不知道 git 在内部如何与 SVN 一起工作,但我想之后应该有一种方法可以添加用户名。

请注意,我正在通过http使用SVN。

您可以在 dcommit 命令中指定用户名,例如

git svn dcommit --username=isapir

我认为您可以使用此过程(从 git svn 手册页)创建现有 svn 存储库的克隆,但更改 git svn 初始化步骤,使其指定用户名。 然后,您的新 git-svn 存储库将有一个用户名。

# 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 --username my_new_name http://svn.example.com/project
# Pull the latest changes from Subversion
    git svn rebase

请注意,如果指定用户名,则无法在 Git 2.16.x/2.17(2018 年第 1 季度)之前提交合并提交。
这是因为"git svn dcommit"没有考虑到 svn+ssh:// 带有username@(通常用于推送)的 URL 是指到没有username@的同一SVN存储库,并在以下情况下失败 svn.pushmergeinfo选项已设置。

参见 提交 8aaed89 (15 Sep 2017) by Jason Merrill ( jwmerrill )。
(由 Jason Merrill -- jwmerrill -- 在 commit 8aaed89 中合并,2017 年 9 月 17 日)

git-svn:修复svn.pushmergeinfo svn+ssh用户名的处理。

以前,svn dcommitsvn.pushmergeinfo集合合并 获取错误消息,例如

merge parent <X> for <Y> is on branch svn+ssh://gcc.gnu.org/svn/gcc/trunk, 
which is not under the git-svn root svn+ssh://jason@gcc.gnu.org/svn/gcc!"

因此,让我们在比较之前调用remove_username(就像我们对svn info所做的那样) 根网址到branchurl .

最新更新