使用 git 更新子模块时发生致命错误 "could not read Username"
Fatal error "could not read Username" when update submodule using git
我遇到了一个奇怪的问题,找了很久没有解决。
我有一个名为 lapp-yhkt
的主项目(本地路径:/g/webstorm/lapp-yhkt
):
和.gitmodules
的内容:
在这个目录中,我按照 Git-Tools-Submodules:
中的步骤
第一个初始化子模块,
$ git submodule init
Submodule 'app/base' (https://git.mobcb.com/liteapp/lapp-base.git) registered for path '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
在这些之后,我还尝试了git submodule sync
和git 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
解法:
当使用 HTTPS URL 克隆然后尝试使用 Git Bash 在 Windows 上使用以下方式推送更改时会出现此问题:
git clone https://github.com/{username}/{repo}.git
但是,使用SSH URL克隆时,没有出现这个问题:
git clone git@github.com:{username}/{repo}.git
我遇到了一个奇怪的问题,找了很久没有解决。
我有一个名为 lapp-yhkt
的主项目(本地路径:/g/webstorm/lapp-yhkt
):
和.gitmodules
的内容:
在这个目录中,我按照 Git-Tools-Submodules:
中的步骤第一个初始化子模块,
$ git submodule init
Submodule 'app/base' (https://git.mobcb.com/liteapp/lapp-base.git) registered for path '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
在这些之后,我还尝试了git submodule sync
和git 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解法:
当使用 HTTPS URL 克隆然后尝试使用 Git Bash 在 Windows 上使用以下方式推送更改时会出现此问题:
git clone https://github.com/{username}/{repo}.git
但是,使用SSH URL克隆时,没有出现这个问题:
git clone git@github.com:{username}/{repo}.git