使用git更新子模块时出现致命错误“无法读取用户名”。

4
我遇到了一个奇怪的问题,花费了很长时间搜索但没有找到解决方案。
我有一个名为lapp-yhkt(本地路径:/g/webstorm/lapp-yhkt)的主项目:enter image description here 以及.gitmodules文件的内容:enter image description here 在该目录下,我按照Git-Tools-Submodules中的步骤进行操作:
首先初始化子模块,
$ git submodule init
Submodule 'app/base' (https://git.mobcb.com/liteapp/lapp-base.git) registered for path 'app/base'

更新IT技术后,出现致命错误。

$ git submodule update
Cloning into 'G:/webstorm/lapp-yhkt/app/base'...
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://git.mobcb.com': Invalid argument
fatal: clone of 'https://git.mobcb.com/liteapp/lapp-base.git' into submodule path 'G:/webstorm/lapp-yhkt/app/base' failed

接下来,我还尝试了git submodule syncgit submodule update

$ git submodule sync
Synchronizing submodule url for 'app/base'


$ git submodule update
Cloning into 'G:/webstorm/lapp-yhkt/app/base'...
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://git.mobcb.com': Invalid argument
fatal: clone of 'https://git.mobcb.com/liteapp/lapp-base.git' into submodule path 'G:/webstorm/lapp-yhkt/app/base' failed

我遇到了同样的错误,这让我很沮丧。希望有人能帮助我,提前致谢。

编辑:我在Windows环境下使用了git。

1个回答

3

解决方案:

在使用HTTPS URL克隆后,通过Git Bash在Windows上尝试推送更改时,会出现此问题。

git clone https://github.com/{username}/{repo}.git

然而,当使用SSH URL进行克隆时,就不会出现这个问题:
git clone git@github.com:{username}/{repo}.git

我已经使用SSH URL克隆了主项目。也许我应该将子模块的URL也改为SSH URL? - Blank
是的,正确的,你可以尝试手动调用 git clone git@github.com:{username}/{repo}.git - LuFFy
因为它明确地说“fatal: clone of *** into submodule path *** failed” - LuFFy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接