在 Azure DevOps 中克隆私有 BitBucket 存储库

clone private BitBucket repo in Azure DevOps

我正在尝试通过 Azure DevOps 中的 bash 任务克隆私有 Bitbucket 存储库。这是命令

git clone --branch master https://username:password@bitbucket.org/repo.git

早些时候我遇到了这个错误

"fatal: could not read Password for 'https://***@bitbucket.org': terminal prompts disabled"

这就是为什么我也在 URL 中包含密码以使其正常工作,但现在我明白了。

fatal: unable to access 'https://bitbucket.org/realogy-abt/apipublishing.git/': Could not resolve host: ***

我已经尝试使用 user.name 和电子邮件设置全局 git 配置,以及远程源 url,但没有任何效果。

git config --global user.email "xxx"
git config --global user.name "xxxx"

我正在通过 Azure DevOps 中的 bash 任务尝试此操作。任何帮助,将不胜感激。 编辑添加:同一个克隆与 Github repo 无缝工作。

我在 bash 任务中使用以下 git 命令对其进行了测试,它有效。

git clone https://username:password@bitbucket.org/Workspace ID/repository.git

用户名显示在 Bitbucket 配置文件设置中。