1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env sh
#!/usr/bin/expect
git add .
git commit -m "file"

set timeout 1

expect -c "
spawn git push -u origin master # 执行交互式命令
expect \"Username for 'https://gitee.com':\" # 当匹配到此条内容
send \"188********\r\" # 则执行此条内容
expect \"Password for 'https://*********@gitee.com':\"
send \"********.\r\"
interact"