git svn clone --password pass gives “Unknown option: password”
Asked Answered
B

3

32

I want to clone a svn repository using git, with a username and password given on the command-line.

I can write:

svn checkout --username user --password pass svn://server/repo

But I can't use --password with git svn clone:

git svn clone --username user --password pass svn://server/repo
Unknown option: password

How can I give the password to git svn clone on the command-line?

Alternatively, is there a kind of --svn-options switch to git-svn?

P.-S. Note that I need to specify it on the command-line, because there are multiple repos on this server with different user/pass, and svn stupidly assumes that all repos use the same username/password, so half of the time I get svn: Authorization failed, without it asking for the password, even if I use --username (it seems to ask for the password sometimes, but it's not robust enough to be used in a script).

Brinkman answered 10/1, 2014 at 9:31 Comment(2)
https://mcmap.net/q/469893/-single-git-svn-command-not-caching-password-for-multiple-svn-actions could helpTolland
@Tolland yes, I had already read that, but none of the solutions are acceptable, as the answer says.Brinkman
T
21

git svn uses SVN commands directly and thus the internally saved password of SVN.

Run the command:

svn checkout --username user --password pass svn://server/repo

and let SVN remember your password.

If this does not work remove the saved SVN authentications:

$HOME/.subversion/auth/svn.simple/*

Then git svn clone will prompt you for the password.

Tripe answered 8/4, 2014 at 5:35 Comment(4)
Just a note. svn checkout can be quite time consuming. There is no need to wait for it to complete though. Once the checkout starts, the password is saved and you can cancel the checkout process (Ctrl+C is windows).Careful
try --depth empty as in svn checkout --username someuser --password somepass --depth empty <svn-url>Windpipe
If you're just running it to get the password reset, you can just do svn log instead of svn checkout. That will probably complete so quickly that it won't be worth your time to try to ctrl+c it.Yapon
This answer explains the managing of the svn password but is not a solution regarding the question.Greatuncle
A
15

Just specify the username with --username and you should be prompted for a password.

See git svn --help or man git svn for further information.

Alita answered 10/11, 2014 at 14:27 Comment(1)
As noted in my question, I needed to give the password on the command-line, not be prompted for it (unless I can safely pipe an "echo" into that or something similar).Brinkman
G
0

You can pipe the password (in batch processing) to git svn ... as described here: https://superuser.com/a/542256/1047499.

Greatuncle answered 20/2 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.