github - 如何从 GitHub 克隆

标签 github cloning

我是使用 GitHub 的新手。我正在尝试从用户存储库中克隆我的第一个文件。
我不断收到此错误:
Permission denied (publickey). fatal: Could not read from remote repository
当我检查以验证公钥是否已附加到我的 GitHub 帐户时,请使用以下命令:
ssh-add -1
我收到此错误:The agent has no identities.
我也试过这个:ssh-add ~/.ssh/id_rsa
它告诉我:
Identity added
我还确保我的笔记本电脑的 SSH key 已添加到我的 GitHub 帐户中。我错过了哪些步骤?

我已经扫描了互联网——我迷路了。

最佳答案

您可以通过 2 种方式克隆 github 存储库。您可以在克隆存储库时选择类型。

See the highlighted part in image

  • HTTPS
    git clone https://github.com/flyway/flyway.git

  • 如果它是私有(private)存储库,您可能需要提供用户名/密码。
  • SSH
    git clone git@github.com:flyway/flyway.git

  • 您需要在您的 PC 中设置 ssh key 并在您的 github 帐户中更新。

    阅读更多关于

    Adding SSH Keys

    Which remote URL should I use?

    关于github - 如何从 GitHub 克隆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26819334/

    相关文章:

    git - 在 GitHub 操作中获取当前分支并提交哈希

    python - 作为开发的一部分,我致力于 github 并在其他地方执行。感觉不对

    github 页面仍在提供已删除的文件

    java - 如何避免继承java类的复制构造函数中的instanceof

    c# - 在 C# 中进行浅拷贝的最快方法

    javascript - 在 JavaScript 中克隆 FileList 对象以进行文件上传?

    git - 图表贡献者为空

    eclipse - 由于存储了错误的密码,因此无法使用 Eclipse (EGit) 从 Github 获取或拉取

    java - 使 LinkedBinaryTree 可克隆

    java - 哪个更快 : Cloning or using Streams?