git - VS Code远程容器:容器中的开放存储库

标签 git docker visual-studio-code azure-devops

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

enter image description here

我想念什么?我可以在终端上克隆仓库:

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给出的URL:
https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole
enter image description here

这是我在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

最佳答案

What am I missing? I can clone the repo just fine from the terminal:



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

enter image description here
FtpUpload是我的Azure Devops存储库的名称。

因此,https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole可在您的终端上运行,而https://eateam.visualstudio.com/Emailage%20Code/_git/piotr-helloworldconsole.git失败并显示错误。在VS代码中使用的网址中删除多余的.git,它应该可以工作。

重现此问题:

enter image description here

关于git - VS Code远程容器:容器中的开放存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60853122/

相关文章:

ruby-on-rails - 通过 Git 更新/部署 Rails 应用程序的最佳工作流程是什么?

docker - 在Windows 10的Laradock Docker上启动工作区时出现权限错误

linux - tar: 无法创建目录 'sqljdbc_7.2/' : 权限被拒绝 tar: 无法打开 'sqljdbc_7.2/' : 是一个目录

python - 从 VS Code 集成终端运行 Python 时,matplotlib 图不会显示

python - VSCode单行执行后运行python文件

git - 对分支名称进行通配符过滤

Git 在 merge 时获取他们或我的文件

visual-studio-code - 是否有关闭智能感知面板(vscode)的键盘快捷键?

node.js - 在 ubuntu 12.04 下以多种方式安装 node.js 0.10.26 失败

Docker 构建错误 : failed to add the host