Single git-svn command not caching password for multiple svn actions

核能气质少年 提交于 2019-12-11 02:05:45

问题


I'm using git-svn to connect to a subversion repository that authenticates via https. I'm using the git command line client on Linux (Ubuntu 12.04). When I perform any command that requires interaction with the subversion server, I must enter my svn password, as expected. However, if the command requires multiple interactions with the svn server (e.g. git svn dcommit with multiple local commits) I must enter the password multiple times.

On another workstation, I have a similar setup which gives me the expect behavior of asking for the password once for the entire series of commits.

I've found similar questions here and here but in both cases the OP wanted the svn credentials cached between git-svn commands. I do not have subversion configured to cache my password and want to keep it that way if I can.

My git-svn version is 1.7.9.5 (svn 1.6.17)


回答1:


The problem is that git svn commands perform multiple Subversion operations using a wrapper around the regular Subversion interfaces; Git doesn't know or care about your Subversion credentials.

I can see a few different options for proceeding, none of which are great:

  • Enable Subversion's credential store. You know about this and have said you don't want to do it, so that's a non-starter.

  • Just type the password in for every Subversion operation that Git performs. Your current solution; if that were good you wouldn't be asking the question.

  • Patch git svn. Git code is open source, and the git svn commands are written in Perl, so you can edit on your system and use the new version without recompiling. Rough design:

    • Whenever interacting with the Subversion repository, first attempt to perform it without interactive authentication (ie a --non-interactive argument to the underlying svn command).

    • If that works, great, carry on. If that fails, assume it fails due to lacking authentication, and prompt the user for a username and password.

    • For later svn commands, if no authentication was needed, carry on like that. Otherwise, specify the stored username and password explicitly (ie --username and --password arguments to the underlying svn command).

Going solo is far from trivial, though. Unless you particularly fancy some hard work digging around in the Git source code, or want this enough to pay someone to do that for you, it looks like this is behaviour you'll need to live with.




回答2:


You need to have the your credentials stored in the subversion directory. A naive solution would be to do a simple checkout of your svn repository in a temporary directory just to have svn saving your username and password:

svn co http://url-of-your-svn/repos/repos temp-repos-directory

In this way svn will ask if you want to save your credentials and they would be saved in your subversion config directory (~/.subversion/aut/ in linux).

Another solution would be ask directly svn to store your credentials:

svn update --username 'username' --password 'password'


来源:https://stackoverflow.com/questions/15690560/single-git-svn-command-not-caching-password-for-multiple-svn-actions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!