首页 > 解决方案 > VS Code Remote-Containers:在容器中打开存储库

问题描述

不确定这是我的问题的正确论坛,但它就在这里。我在使用 vs 代码(F1 -> 远程容器:在容器中打开存储库)在容器中打开我的 azure-devops 存储库时遇到问题。操作失败并显示以下消息:

在此处输入图像描述

我错过了什么?我可以从终端很好地克隆 repo:

piotr@EMEA00304 Downloads % git clone https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole
Cloning into 'piotr-helloworldconsole'...
remote: Azure Repos
remote: We noticed you're using an older version of Git. For the best experience, upgrade to a newer version.
remote: Found 4 objects to send. (71 ms)
Unpacking objects: 100% (4/4), done.
piotr@EMEA00304 Downloads % cd piotr-helloworldconsole 
piotr@EMEA00304 piotr-helloworldconsole % ls
HelloWorldConsole.csproj    Program.cs

我是否需要以某种方式使用我的凭据配置 vs 代码?

如果这很明显,我很抱歉,但在文档中找不到任何内容:https ://code.visualstudio.com/docs/remote/troubleshooting#_container-tips

我使用的 vs 代码版本是1.43.2.


更新:

我仔细检查了,我在终端和 vs 代码中使用了相同的 URL,由 azure-devops ui 给出:

https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole

在此处输入图像描述

这是我在 vs 代码中得到的输出:

[0 ms] Start: Resolving remote
[4 ms] Start: Check Docker is running
[32 ms] Start: Run: docker build -f /Users/piotr/.vscode/extensions/ms-vscode-remote.remote-containers-0.106.0/scripts/volumeBootstrap.Dockerfile -t vsc-volume-bootstrap /Users/piotr/.vscode/extensions/ms-vscode-remote.remote-containers-0.106.0/scripts
[140 ms] Sending build context to Docker daemon   7.68kB
[209 ms] Step 1/2 : FROM alpine:3.11.2
[210 ms]  ---> cc0abc535e36
Step 2/2 : RUN apk add --no-cache       nodejs  git     openssh-client  docker-cli      ;
 ---> Using cache
 ---> d89d8b8c3615
[210 ms] Successfully built d89d8b8c3615
[214 ms] Successfully tagged vsc-volume-bootstrap:latest
[216 ms] Cloning Github repository: _git/piotr-helloworldconsole.git into /workspaces/piotr-helloworldconsole

[217 ms] Start: Run: docker run -d --mount src=vsc-remote-containers,dst=/workspaces,type=volume,volume-driver=local -v /var/run/docker.sock:/var/run/docker.sock vsc-volume-bootstrap sleep infinity
[592 ms] Start: Run: docker exec -i -u root 1092b2cb7af09d3f9c9648f243f2279ac7ad895e215d859be57542c9f3d87f0e /bin/sh
[596 ms] Start: Launching Remote-Containers helper.
[598 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global credential.helper '!f() { node /tmp/vscode-remote-containers-d357f963b0fea8b37100746ad6d1376e6226b019.js $*; }; f' || true
[737 ms] 
[737 ms] 
[737 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-d357f963b0fea8b37100746ad6d1376e6226b019.js' >/tmp/vscode-remote-containers-d357f963b0fea8b37100746ad6d1376e6226b019.js
[741 ms] 
[741 ms] 
[1081 ms] Start: Run: docker exec -u root -e SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-d357f963b0fea8b37100746ad6d1376e6226b019.sock -e REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-d357f963b0fea8b37100746ad6d1376e6226b019.sock 1092b2cb7af09d3f9c9648f243f2279ac7ad895e215d859be57542c9f3d87f0e git clone https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole.git /workspaces/piotr-helloworldconsole
[1207 ms] Cloning into '/workspaces/piotr-helloworldconsole'...
[2346 ms] remote: TF401019: The Git repository with name or identifier piotr-helloworldconsole.git does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole.git/' not found

标签: gitdockervisual-studio-codeazure-devops

解决方案


我错过了什么?我可以从终端很好地克隆 repo:

您为 Azure Devops 存储库使用了错误的 Url 格式。与普通的 GitHub url 不同,Azure Devops Repos 的正确 Url 格式以ReposName而不是.git.

在此处输入图像描述

FtpUpload是我的 Azure Devops 存储库的名称。

所以https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole在您的终端中工作,而https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole.git失败并出现错误。删除.git您在 VS 代码中使用的 Url 中的额外内容,它应该可以工作。

要重现该问题:

在此处输入图像描述


推荐阅读