如何克隆私人bitbucket回购窗口docker容器

我正在尝试使用Windowsdocker容器来运行我的源代码(基础镜像: FROM azuresdk/azure-powershell:4.4.0 ;我在我的版本的dockerfile中安装了git)的构build/testing过程。 我需要它从无bitless克隆/拉最新版本的回购,所以我可以让它自动运行testing和部署最新版本。 为了validation到bitbucket,我已经生成了一个公钥/私钥对,并将公钥放在bitbucket中,并将私钥放在容器中(使用docker docker cp复制到mycontainer:C:\ Users \ ContainerAdministrator.ssh \ mykey)。

当我运行git clone git@bitbucket.org:myteam/myrepo.git (来自这里的语法)时,git告诉我:

  fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

我究竟做错了什么?

笔记:

  • docker容器需要是Windows,因为我需要PowerShell 5而不是PowerShell核心。
  • 我需要克隆发生docker集装箱,因为集装箱的运行将自动化,但它的build设将不会。
  • 我知道ssh-agent正在容器中运行,因为在运行Get-Process powershell命令时列出了它
  • 为了添加私钥到ssh-agent ,我执行了ssh-add <path to priv key> 。 我在容器中运行git-bash时遇到了麻烦,并且在这里使用了这个方法。 在我的情况下,这成为'C:\Program Files\Git\bin\sh.exe' --login -i -c "ssh-add /c/Users/ContainerAdministrator/.ssh/mykey" 。 我确认这个方法适用于'C:\Program Files\Git\bin\sh.exe' --login -i -c "echo hi>C:\results.txt"
  • 在尝试添加ssh私钥之后,我运行了echo $(ssh-add -l)>/c/myresults.txt" (在我的本地机器上testing过),使用与上面相同的sh.exe语法,但是它没有显示任何结果输出文件,也许问题是我的私钥没有被加载到其他的ssh-agent;不知道。