Git推"权限被拒绝"

Alp*_*der 0 git push github public-key

我试图将我的代码推送到我的github帐户,但无论何时我尝试,我都会得到这个

Pushing to git@github.com:AlphaModder/Space-Dimension-Mod.git
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

问题:如何避免"权限被拒绝"?GitHub远程地址是否有效?

Von*_*onC 6

我建议使用https地址作为远程"来源":

https://github.com/AlphaModder/Space-Dimension-Mod.git
Run Code Online (Sandbox Code Playgroud)

这样可以避免处理ssh设置的所有复杂问题.
另外,您也可以缓存凭据.

如果你确实需要一个ssh地址...那么请参见例如" ssh,github,它不起作用 ".

  • 这个问题很完美.我可以在.git/config中将远程源修改为上面指定的格式后提供我的凭据...谢谢 (2认同)