Git

解决 Git Access Token Error: `remote: You must use a personal access token ...`

背景

在家远程办公的时候执行 git clone 出现以下报错:

remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'api' scope for Git over HTTP.

Access denied

这个错误表明: 基于 HTTP Basic Authentication 的传统用户名/密码认证方式已被弃用或禁用。

解决方案

通过其提示的地址生成一个 Token:

remote: You can generate one at https://example.com/profile/personal_access_tokens

Generate

然后通过命令行组合 Token 操作即可:

git clone https://oauth2:${PERSONAL_ACCESS_TOKEN}@example.com/example/example.git

Git

更新记录

本文首次编辑于 2023-05-29,最近更新于 2025-12-07。

版权声明

本文为原创文章,作者保留版权。转载请保留本文完整内容,并以超链接形式注明作者及原文出处。

作者: 除除
原文: http://blog.mazey.net/3488.html

(完)

1 条评论

  1. reviewer
    除除
    2023年6月17日

    `git clone` 报错,解决 `remote: You must use a personal access token with 'api' scope for Git over HTTP.`

评论已关闭