简体   繁体   English

WSL2中运行Docker,面临git登录问题

[英]Running Docker in WSL2, facing git login problem

I'm trying to run docker in WSL2.我正在尝试在 WSL2 中运行 docker。 I installed Ubuntu and it starts fine, I configured my git access with ssh key stored in.ssh and tested the access with ssh my-git-server.com and it gives the welcome information.我安装了 Ubuntu 并且启动正常,我使用存储在 .ssh 中的 ssh 密钥配置了我的 git 访问权限,并使用ssh my-git-server.com测试了访问权限,它提供了欢迎信息。 I also installed docker desktop for windows and selected WSL integration.我还为windows安装了docker桌面,并选择了WSL集成。

I did docker login to the git server for the docker, it was also successful.我为docker做了docker登录git服务器,也成功了。

I can start docker-compose and get the docker running.我可以启动 docker-compose 并让 docker 运行。

When I tried to run cmake in docker, I was hit with login request:当我尝试在 docker 中运行 cmake 时,我遇到了登录请求:

Username for 'https://"my-git-server".com':

and I can use my username and password to login, but then it will pop up request for that again.我可以使用我的用户名和密码登录,但随后它会再次弹出请求。

I tried to add docker credential helper with no help for this issue.我尝试添加 docker 凭证助手,但没有解决此问题。 git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe" doesn't help this issue either, because docker image doesn't have the c drive mounted, doesn't have git binaries or docker binaries either. git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"也没有解决这个问题,因为 docker 图像没有安装了 c 驱动器,也没有 git 二进制文件或 docker 二进制文件。

Some action in your cmake build tries to access your repo through https , not ssh . cmake 构建中的某些操作会尝试通过https而不是ssh访问您的存储库。

You may either:您可以:

  1. spot that action and change the way your repository gets cloned,发现那个动作并改变你的存储库被克隆的方式,

  2. or add a insteadOf configuration entry within your docker environment:或在 docker 环境中添加insteadOf配置条目:

git config --global \
        url."git@my-git-server.com:".insteadOf my-git-server.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM