nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

Unknown option: password #292

Open lq2009 opened 4 years ago

lq2009 commented 4 years ago

(⊙o⊙)? [root@local]svn2git https://172.16.3.3/svn/ywzl --user='liqiang' --password '123456' --rootistrunk Unknown option: password command failed: git svn init --prefix=svn/ --username='liqiang' --password='123456' --no-metadata --trunk='https://172.16.3.3/svn/ywzl'

belgoros commented 4 years ago

@potato09 you don't need to use quotes, the right syntax is to separate the password value by space from --password option: --password YOUR_PASSWORD as it is indicated in README. The same is for any other available option. You can find more details in OptionParser API docs.

axbusch commented 3 years ago

No, space seperation does not work.

I have the same issue

mcardia commented 3 years ago

same error here. The password has symbols, if it helps. And, if I type the password I got:

#<Thread:0x0000562f9d12e008 /var/lib/gems/2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:431 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        2: from /var/lib/gems/2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `block (2 levels) in run_command'
        1: from /var/lib/gems/2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `loop'
/var/lib/gems/2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:438:in `block (3 levels) in run_command': undefined local variable or method `stdin' for #<Svn2Git::Migration:0x0000562f9d126b28> (NameError)
Did you mean?  String

My workarround was to change the file migrate.rb using "echo password |" instead of option password

        cmd = "echo #{password} |" + cmd unless password.nil?

        # Add each component to the command that was passed as an argument.
        cmd += "--username='#{username}' " unless username.nil?
        #cmd += "--password='#{password}' " unless password.nil?
jesteves commented 2 years ago

I've just made a PR to remove the support of --password and also to support password specification for git-svn via an environment variable. I followed the "echo-pipe" technique commented by @mcardia.

Such changes worked fine for me.

If anyone is interested, the PR is here and my fork, here.

ghost commented 2 years ago

--password doesn't work anymore, you have to manually input the password or use the workaround to set an env var.

I actually had even more issues and svn2git didn't work for me at all.

I managed to migrate using the steps outlined here https://gist.github.com/leftclickben/322b7a3042cbe97ed2af

ibaoger commented 2 years ago
gem uninstall svn2git
gem install svn2git3
SVN2GIT_PASSWORD=<<password>> svn2git http://svn.example.com/path/to/repo --username <<user_with_perms>>

this issue has resolved by @jesteves, I pushed it to rubygems.