【发布时间】:2021-12-29 12:31:15
【问题描述】:
我在一个 python lambda 中有这个小代码,它试图从 bitbucket 中提取一个 repo:
import git
def git_clone(username,password):
new_dir = os.getcwd() + "/temp/"
os.chdir(new_dir)
GIT_URL = "https://{0}:{1}@bitbucket.org/test-project/test.git".format(username,password)
git.Git(new_dir).clone(GIT_URL)
git 方法接受我的用户名但不接受我的密码。我的密码包含字母、数字和特殊字符。我收到此错误:
URL using bad/illegal format or missing URL
这可能是格式问题吗?
【问题讨论】:
-
尝试将其设为原始字符串
r" -
密码中的特殊字符必须是 URL 编码的。
-
我试过
r"。仍然没有运气@rv.kvetch -
我该怎么做? @phd
-
不要将凭据放在 URL 中,因为这意味着它们会被写入磁盘。使用credential helper。