5

我使用git svn clone. 那时,我在那个站点没有用户名,因此没有--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 手册似乎没有帮助:只允许在initand上添加用户名branch。我不知道 git 在内部如何与 SVN 一起工作,但我想应该有一种方法可以在之后添加用户名。

请注意,我在 http 上使用 SVN。

4

3 回答 3

1

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

git svn dcommit --username=isapir
于 2018-07-09T07:00:58.430 回答
0

我认为您可以使用此过程(来自 git svn 手册页)创建现有 svn 存储库的克隆,但更改 git svn init 步骤以指定用户名。然后,您的新 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
于 2012-08-14T16:59:53.507 回答
0

请注意,如果您指定用户名,则无法在 Git 2.16.x/2.17(2018 年第一季度)之前提交合并提交。
这是因为 " git svn dcommit" 没有考虑这样一个事实,即 带有 a (通常用于推送)的svn+ssh://URL引用相同的 SVN 存储库而没有设置选项时会失败 。username@username@svn.pushmergeinfo

请参阅Jason Merrill ( )的提交 8aaed89(2017 年 9 月 15 日) 。(由Jason Merrill合并——提交 8aaed89中,2017 年 9 月 17 日)jwmerrill
jwmerrill

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

以前,svn dcommitsvn.pushmergeinfoset 合并会收到错误消息,例如

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_usernamesvn info比较 rooturl 和branchurl.

于 2018-01-28T06:11:05.337 回答