使用子模块检出 git 存储库时出错
Error while checking out git repository with submodules
在 Jenkins 实例上部署我的测试时,我注意到某些子模块无法初始化。
在 Jenkins 中,我选中了 Use credentials from default remote of parent repository
的复选框,这使得初始化第一个子模块成为可能。不幸的是,无论我做什么,其余的都不起作用。
> git remote # timeout=10
> git submodule init # timeout=10
> git submodule sync # timeout=10
> git config --get remote.origin.url # timeout=10
> git submodule init # timeout=10
> git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
> git config --get submodule.sub1.url # timeout=10
> git remote # timeout=10
> git config --get remote.origin.url # timeout=10
> git config -f .gitmodules --get submodule.sub1.path # timeout=10
using GIT_SSH to set credentials
> git submodule update --init --recursive sub1
> git config --get submodule.sub2.url # timeout=10
> git remote # timeout=10
> git config --get remote.origin.url # timeout=10
> git config -f .gitmodules --get submodule.sub2.path # timeout=10
using GIT_SSH to set credentials
> git submodule update --init --recursive sub2
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "git submodule update --init --recursive sub2" returned status code 1:
stdout:
stderr: Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@bitbucket.org:xxxx/xxx.git/sub2' into submodule path '/var/jenkins_home/workspace/develop/sub2' failed
Failed to clone 'sub2'. Retry scheduled
Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.
我还在 .git/config
中检查过,我有正确的路径到 bitbucket 中的其他存储库。
该错误与 jenkins 或 bitbucket 无关,而是 git 配置错误。 .git/config
未被跟踪,但 .gitmodules
被跟踪。
路径 git@bitbucket.org:xxxx/xxx.git/sub2
应该让我注意到实际的错误,它在 .gitmodules
:
[submodule "sub1"]
path = sub1
url = git@bitbucket.org:xxxx/sub1.git
[submodule "sub2"]
path = sub2
url = ./sub2
由于 git 未跟踪的不同本地配置,它在本地工作。基本上在.gitmodules
,应该只是地址。
我在组装存储库并在本地克隆上使用 git submodule add sub2
时犯了一个错误,而不是完全检查它。
我遇到了同样的问题。从它们的物理位置删除所有子模块并重试:
git submodule update --init
我想修改我的 git 子模块的路径,但遇到 git 子模块更新的多个问题
要修复,
- 删除了“.git/modules”下的子模块相关文件夹
- 用正确的路径修改我的 .gitmodules 文件
- 在命令行上执行了“
git submodule deinit -f <submodule folder>
”
- 使用我的 TortoiseGit
git“子模块更新”
在 Jenkins 实例上部署我的测试时,我注意到某些子模块无法初始化。
在 Jenkins 中,我选中了 Use credentials from default remote of parent repository
的复选框,这使得初始化第一个子模块成为可能。不幸的是,无论我做什么,其余的都不起作用。
> git remote # timeout=10
> git submodule init # timeout=10
> git submodule sync # timeout=10
> git config --get remote.origin.url # timeout=10
> git submodule init # timeout=10
> git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
> git config --get submodule.sub1.url # timeout=10
> git remote # timeout=10
> git config --get remote.origin.url # timeout=10
> git config -f .gitmodules --get submodule.sub1.path # timeout=10
using GIT_SSH to set credentials
> git submodule update --init --recursive sub1
> git config --get submodule.sub2.url # timeout=10
> git remote # timeout=10
> git config --get remote.origin.url # timeout=10
> git config -f .gitmodules --get submodule.sub2.path # timeout=10
using GIT_SSH to set credentials
> git submodule update --init --recursive sub2
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "git submodule update --init --recursive sub2" returned status code 1:
stdout:
stderr: Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@bitbucket.org:xxxx/xxx.git/sub2' into submodule path '/var/jenkins_home/workspace/develop/sub2' failed
Failed to clone 'sub2'. Retry scheduled
Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.
我还在 .git/config
中检查过,我有正确的路径到 bitbucket 中的其他存储库。
该错误与 jenkins 或 bitbucket 无关,而是 git 配置错误。 .git/config
未被跟踪,但 .gitmodules
被跟踪。
路径 git@bitbucket.org:xxxx/xxx.git/sub2
应该让我注意到实际的错误,它在 .gitmodules
:
[submodule "sub1"]
path = sub1
url = git@bitbucket.org:xxxx/sub1.git
[submodule "sub2"]
path = sub2
url = ./sub2
由于 git 未跟踪的不同本地配置,它在本地工作。基本上在.gitmodules
,应该只是地址。
我在组装存储库并在本地克隆上使用 git submodule add sub2
时犯了一个错误,而不是完全检查它。
我遇到了同样的问题。从它们的物理位置删除所有子模块并重试:
git submodule update --init
我想修改我的 git 子模块的路径,但遇到 git 子模块更新的多个问题 要修复,
- 删除了“.git/modules”下的子模块相关文件夹
- 用正确的路径修改我的 .gitmodules 文件
- 在命令行上执行了“
git submodule deinit -f <submodule folder>
” - 使用我的 TortoiseGit git“子模块更新”