git-svn:如何在dcommit上更改svn用户名? [英] git-svn: how to change the svn username on dcommit?
问题描述
我使用git svn clone
将SVN存储库克隆到了git存储库中.当时,我在该站点上没有用户名,因此没有使用clone
的--username
选项.由于现在可以使用新的用户名提交到SVN存储库,因此我想添加该用户名.没有它,dcommit
只会失败:
I cloned a SVN repository into a git repository using git svn clone
. At that point in time, I did not have a username at that site and hence didn't use the --username
option of clone
. As I can now commit to the SVN repository with my new username, I would like to add that username. Without it, dcommit
simply fails:
% 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手册帮助:仅在init
和branch
上添加用户名.我不知道git在内部如何与SVN一起使用,但是我想应该有一种以后添加用户名的方法.
Is there a way to tell git about a new username? The git-svn manual doesn't seem to help: adding a username is only allowed on init
and branch
. I don't know how git works with SVN internally, but I guess there should be a way to add a username afterwards.
请注意,我正在通过http使用SVN.
Note that I am using SVN over http.
推荐答案
我认为您可以使用此过程(来自git svn联机帮助页)来创建现有svn存储库的副本,但可以更改git svn初始化步骤,以便它指定一个用户名.这样,新的git-svn存储库将具有一个用户名.
I think you can use this procedure (from the git svn manpage) to create a clone of your existing svn repository, but change the git svn init step so that it specifies a username. Your new git-svn repository will then have a username.
# 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-svn:如何在dcommit上更改svn用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!