本地添加Git子模块失败求助:file协议受限及SSH分支报错
本地Git子模块添加失败的尝试记录
需要在islandpk仓库中将本地yoken包部署到src/yoken路径,作为Git子模块使用以获取本地Python包的使用权限,但多次尝试均失败,以下是具体尝试过程及报错:
尝试1:直接使用本地绝对路径
执行命令:
git submodule add /Users/hecate/Applications/persephone-python-pac/src/yoken ./src/yoken
报错:
Cloning into '/Users/hecate/Applications/islandpk/src/yoken'... fatal: transport 'file' not allowed fatal: clone of '/Users/hecate/Applications/persephone-python-pac/src/yoken' into submodule path '/Users/hecate/Applications/islandpk/src/yoken' failed
尝试2:使用file://协议
执行命令:
git submodule add file:///Users/hecate/Applications/persephone-python-pac/src/yoken ./src/yoken
报错:
Cloning into '/Users/hecate/Applications/islandpk/src/yoken'... fatal: transport 'file' not allowed fatal: clone of 'file:///Users/hecate/Applications/persephone-python-pac/src/yoken' into submodule path '/Users/hecate/Applications/islandpk/src/yoken' failed
尝试3:使用相对路径
执行命令:
git submodule add ../persephone-python-pac/src/yoken src/yoken
报错:
Cloning into '/Users/hecate/Applications/islandpk/src/yoken'... fatal: transport 'file' not allowed fatal: clone of '/Users/hecate/Applications/persephone-python-pac/src/yoken' into submodule path '/Users/hecate/Applications/islandpk/src/yoken' failed
尝试4:改用本地裸仓库
先后执行以下命令,均出现相同报错:
git submodule add file:///Users/hecate/.git-repos/yoken/ src/yoken
git submodule add /Users/hecate/.git-repos/yoken/ src/yoken
git submodule add -- /Users/hecate/.git-repos/yoken/ src/yoken
报错:
Cloning into '/Users/hecate/Applications/islandpk/src/yoken'... fatal: transport 'file' not allowed fatal: clone of '[对应仓库路径]' into submodule path '/Users/hecate/Applications/islandpk/src/yoken' failed
尝试5:改用远程SSH仓库
执行命令:
git submodule add ssh://xxxx:/home/rand_usr/.git-repos/yoken ./src/yoken
执行过程及报错:
Cloning into '/Users/hecate/Applications/islandpk/src/yoken'... rand_usr@xx.xx.x.xx's password: remote: Counting objects: 7, done. remote: Compressing objects: 100% (6/6), done. remote: Total 7 (delta 1), reused 0 (delta 0) Receiving objects: 100% (7/7), done. Resolving deltas: 100% (1/1), done. fatal: You are on a branch yet to be born fatal: unable to checkout submodule 'src/yoken'
内容的提问来源于stack exchange,提问作者croakouttatune
相关产品推荐
相关产品推荐

