Fork me on GitHub

Git拉取身份验证问题

root@z-Default-string:/app/xmy# git pull fatal: could not read Username for 'https://gitee.com': terminal prompts disabled fatal: could not read Username for 'https://gitee.com': terminal prompts disabled here i'm in visual studio to open a container

 

在使用 Visual Studio Code(VSCode)连接 Docker 容器时运行 git pull,但遇到以下错误:

fatal: could not read Username for 'https://gitee.com': terminal prompts disabled

这是因为在容器中执行 git pull,而 Git 想要提示输入 Gitee 的用户名和密码,但在容器的无交互终端环境中无法显示提示框。

 

解决方案:使用 Gitee 的 HTTPS Token

格式:https://<username>:<token>@gitee.com/<username>/<repo>.git

完整命令:git remote set-url origin https://userrname:username's HTTPS Token@gitee.com/xxx/xxx.git

 

posted @ 2025-05-30 18:43  z_s_s  阅读(56)  评论(0)    收藏  举报