简体   繁体   English

SSH 密钥使用 Git

[英]SSH key using Git

I'm new to GitHub and, after having followed this tutorial , I'm trying to understand SSH keys.我是 GitHub 的新手,在遵循本教程之后,我试图了解 SSH 键。

I already created a key and added it to my account.我已经创建了一个密钥并将其添加到我的帐户中。 For the moment I have no more than a few test repositories, which I clones locally.目前我只有几个测试存储库,我在本地克隆它们。

Now, the problem is that, even if I do not set my ssh-agent (or I remove all the keys from GitHub) I can still update my repos and push to them.现在,问题是,即使我没有设置我的ssh-agent (或者我从 GitHub 中删除了所有密钥),我仍然可以更新我的存储库并推送给它们。

The only thing I can't do with a verified key is cloning a repository using the SSH link (eg git@github.com:username/repository.git ), but I can still clone and push to repositories using the https link (eg https://github.com/username/repository.git ). The only thing I can't do with a verified key is cloning a repository using the SSH link (eg git@github.com:username/repository.git ), but I can still clone and push to repositories using the https link (eg https://github.com/username/repository.git )。

I initially thought that cloning was allowed using the https but I could not push, but I can even push and it does not ask any usernames of passwords!我最初认为可以使用 https 进行克隆,但我无法推送,但我什至可以推送,而且它不会询问任何用户名密码!

So, what's the purpose of SSH keys if anyone can still do the same things that I do with a verified key?那么,SSH 密钥的目的是什么,如果有人仍然可以做与我使用经过验证的密钥相同的事情? Does it have to do with privileges and permissions?它与特权和权限有关吗?

but I can still clone and push to repositories using the https link (eg https://github.com/username/repository.git ).但我仍然可以使用 https 链接(例如https://github.com/username/repository.git )克隆并推送到存储库。

When using HTTPS, you would not use any SSH key, only cached credentials (GitHub account username/password), that would be provided by the git credential helper ( git config credential.helper ) When using HTTPS, you would not use any SSH key, only cached credentials (GitHub account username/password), that would be provided by the git credential helper ( git config credential.helper )

printf "protocol=https\nhost=github.com"|git credential-xxx erase

Replace xxx by the helper returned by git config credential.helpergit config credential.helper返回的助手替换 xxx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM