微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何处理具有多个标识和Visual Studio Code开发容器的大量.gitconfig? 更新

如何解决如何处理具有多个标识和Visual Studio Code开发容器的大量.gitconfig? 更新

似乎是Visual Studio Code,它是dev容器在创建时复制.gitconfig。由于必须管理不同的身份,因此我有相当广泛的.gitconfig,可以有条件地加载其他配置文件。例如:

[includeIf "gitdir:~/Workspace/github.com/"]
    path = .gitconfig-github.com

当然,Visual Studio Code不会复制它们,即使它不能工作,因为有条件的条件也不适用,因为它将检测到错误的目录。

无论如何,是否可以在工作目录中的容器外部运行git config --get user.namegit config --get user.email并在创建时将其设置为devcontainer?


更新

问题是不可能从docker-compose.ymlDockerfile内的命令中检索返回值以将其移交给容器吗?

version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        VARIANT: 14
        GIT_USERNAME: ${git config --get user.name}
        GIT_USERMAIL: ${git config --get user.email}
    volumes:
      - ..:/workspace:cached
    command: sleep infinity

类似的事情是行不通的。有解决方法吗?

解决方法

如图所示:

  • commit 1641597(更新def xmlFile = "$androidWorkingDirPath/app/src/main/res/values/colors.xml" def xml = new XmlParser().parse(xmlFile) xml.color[0].each { //it.@name = "test2" //it.value = "test2" println("it.value=$it.value") println("it.value=$it.value.name") } new XmlNodePrinter(new PrintWriter(new FileWriter(xmlFile))).println("Xmlvalue=$xml") 个文件以装入docker-compose.yml
  • commit 3ad0b8b(现在复制.gitconfig,将其复制,然后删除)

创建新容器时,您需要修改/修补.gitconfig和其他container-templates/docker-compose/.devcontainer/docker-compose.yml,以便添加VSCode自动执行的任何指令。

该路径将包括一种选择正确的配置/身份以用于相应地修改已安装的containers/xxx/.devcontainer/docker-compose.yml的方法。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。