Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有多个存储库,我想将它们从 svn 转换为 git。我尝试编写一个简单的期望脚本来转换一个 repo。
#!/usr/bin/expect spawn svn2git svn://svn-server/repo --username $username --verbose expect {Password for '$username'} send "$password\r"
他输入密码,然后超时退出。
我认为 svn2git 需要几秒钟才能完成。send在你的命令之后添加这个
send
set timeout -1 expect eof
Git 在内部启动 SSH 以连接到远程存储库,并且 SSH 会检测它何时从另一个程序启动,并且不允许从脚本输入密码作为安全功能。
您将需要一个专门的程序,例如sshpass从脚本将密码输入 SSH,或设置 SSH 密钥。
sshpass