请求的URL返回错误:403访问github.com时禁止访问

Use*_*ser 5 git github

所以,我在另一台机器上有一个repo设置.我已经提交并推送文件,他们在github.com上查看正常.现在,我已经git init在另一台机器上跑了,我正试着拉.

# git remote set-url origin git@github.com:me/someproj.git
fatal: No such remote 'origin'

# git remote add origin https://github.com/me/someproj.git

# git pull
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/me/someproj.git/info/refs

fatal: HTTP request failed

# git remote -v
origin  https://github.com/me/someproj.git (fetch)
origin  https://github.com/me/someproj.git (push)

# git pull origin
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/me/someproj.git/info/refs

fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 9

您需要检查在推送到GitHub的计算机上使用的凭据(用户名/密码),并在新的本地存储库中重新使用这些凭据.

特别检查使用的URL类型:ssh(git@github.com:me/someproj.git)或https(https://github.com/me/someproj.git).
检查您是否使用2FA(双因素身份验证)或不使用该GitHub帐户和repos.

您可以在您的网址中嵌入正确的用户名 ::

cd /path/to/new/local/repo
git remote add origin https://me@github.com/me/someproj.git
Run Code Online (Sandbox Code Playgroud)