我是 python 新手,我想用密码 git clone SSH 密钥。通过引用此https://stackoverflow.com/a/45219868/12095967,我将其尝试为:
from subprocess import Popen, PIPE
password = 'Password@'
proc = Popen(['git', 'clone', 'git@gitlab.com:gitlab.com/julie/board.git'], stdin=PIPE)
proc.communicate(password)
这是它给出的输出:
Traceback (most recent call last):
File "C:\Users\dell\eclipse-workspace\GitTrial\Git\__init__.py", line 123, in <module>
proc.communicate(password)
File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1009, in communicate
self._stdin_write(input)
File "C:\Users\dell\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 958, in _stdin_write
self.stdin.write(input)
TypeError: a bytes-like object is required, not 'str'
Cloning into 'board'...
Permission denied, please try again.
Permission denied, please try again.
git@gitlab.com: Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我正在使用 Windows 10。有人可以帮我解决这个问题吗?