1

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 Answers2

0

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.

pelya
  • 4,326
  • 2
  • 24
  • 23
0

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

set timeout -1
expect eof
glenn jackman
  • 238,783
  • 38
  • 220
  • 352