重定向'git clone'的stdout/stderr/stdin

Kyl*_*ylo 6 python git

我想写一个程序,它将克隆远程git存储库,然后做一堆其他的东西.问题是'git clone'要求输入密码.当我打开stdin/out/err到'git clone'的管道时,它不起作用,因为它在下面运行git-remote-http,提示在TTY上输入密码.

我想从我的程序中传递密码.我在子进程中使用Python和Popen.下面的代码没有wotk.

Popen(['git', 'clone', 'https://my.git.repo/repo.git'], shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE)
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

ziu*_*ziu 2

如果您不想像评论者所说的那样使用质询身份验证,我会使用pexpect来自动化这种交互