这是错误:
➜ leetcodebypython git:(master) git push
ssh: Could not resolve hostname ssh.github.com: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我运行后:
ssh -T git@github.com
git config --local -e
从
更改URL的输入git@github.com:username/repo.git
to
https://github.com/username/repo.git
加载https://github.com
时,我的Chrome也会有"不安全"的警告。如何管理它?
您的远程git URL不正确;SSH URL的一般格式是:
git@github.com:username/repo.git
和HTTPS URL的一般格式是:
https://github.com/username/repo.git
username
是一个人或组织,而 repo
是您要连接到的存储库,例如,如果您的存储库为 hello-world
,而您的github用户名是 bigbugboy
,则ssh存储库url是:
git@github.com:bigbugboy/hello-world.git
要开始使用GitHub,如果您登录到GitHub帐户,使用UI创建一个新的存储库,从UI中获取SSH URL,然后使用该URL在本地克隆您的存储库,例如。:
git clone git@github.com:bigbugboy/hello-world-again.git
当您在存储库URL中使用GIT协议时,GIT会处理SSH连接详细信息,因此您不直接使用SSH;您只使用git。但是,在您可以通过SSH将更新推向GitHub存储库之前,您必须将SSH密钥添加到GitHub中的帐户中,该帐户在您的GitHub帐户设置" SSH和GPG密钥"下进行。
<。