Using expect to migrate multiple repositories

58 Views Asked by At

I have multiple repositories , which I want to convert to git from svn. I try to write a simple expect script that convert one repo.

#!/usr/bin/expect 

spawn svn2git svn://svn-server/repo --username $username --verbose 
expect {Password for '$username'} 
send "$password\r" 

He puts password but then exit by timeout.

2

There are 2 best solutions below

1
On

Git launches SSH internally to connect to a remote repository, and SSH detects when it is launched from another program, and disallows to enter passwords from scripts as a security feature.

You will need a specialized program like sshpass to enter passwords into SSH from scripts, or set up SSH keys.

0
On

I presume svn2git takes more than a few seconds to complete. Add this after your send command

set timeout -1
expect eof