问题描述
当我从本地登录中拉出但尝试通过PSEXEC登录到Windows 7 git版本2.28.0.windows.1并尝试拉出它显示的更改时,一切工作正常
git.exe :
+ CategoryInfo : NotSpecified: (:String) [],RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Process is terminated due to StackOverflowException.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No such file or directory
仅当我尝试以PSEXEC模式退出时,即使我也以管理员身份并通过同一本地帐户登录,这种情况才会发生。
解决方法
该错误可能与以下内容有关:
- 一个私有存储库(这意味着您需要对每个Git远程命令进行身份验证,例如pull)
- 凭据助手(检查通过psexec返回的
git config credential.helper
是什么)
如果存在要求用户名的交互式过程,请尝试作为一种解决方法/测试,以在HTTPS URL中包含所述用户名:
git remote set-url origin https://<username>@github.com/<username>/<myrepo>
OP Siva Manasan会在注释中报告它在同时指定用户名和密码时起作用。
git remote set-url origin https://<username>:<password>@github.com/<username>/<myrepo>.git
理想情况下,如果Git for Windows所访问的远程计算机上安装了 microsoft / Git-Credential-Manager-for-Windows(及其相关的psexec)的最新版本。
首先检查远程计算机上Git的安装位置:
psexec <...parameters for remote machine> where git
然后使用远程凭据帮助程序注册密码:
psexec <params> [path\to\git]\mingw64\libexec\git-core\git-credential-manager.exe store < afile
# with afile:
protocol=https
host=github.com
username=some-account
password=personaltoken
注意:使用PAT (Personal Access Token)比使用实际密码更好:更安全,您可以随时撤消PAT,而不必更改密码。
然后仅包含您的用户名的简单URL就足够了:
git remote set-url origin https://<username>@github.com/<username>/<myrepo>.git