繁体   English   中英

将gitlab存储库克隆到新设备

[英]cloning a gitlab repository to a new device

我有一个gitlab资料库,已将很多文件推送到其中。

我想将这些文件拉到新的Google计算引擎VM。

我登录

git config --global user.name "MY NAME"
git config --global user.email "MYEMAIL@gmail.com"

以及类型:

git clone git@gitlab.com/MYPROJECT.git

但是我得到了错误:

cloning into 'MYPROJECT'...
permissions denied (publickey).
fatal: Could not read from remote repository

Please make sure you have the correct access rights
and the repository exists.

我认为这与缺少ssh密钥的新设备有关,但是如何将其移至当前只能通过命令行访问的设备?

首先,请注意...

git config --global user.name "MY NAME"
git config --global user.email "MYEMAIL@gmail.com"

...与“登录”或身份验证无关。 这些只是Git用于将名称和电子邮件地址与您所做的提交相关联的值。

您正在使用ssh从远程存储git@gitlab.com/MYPROJECT.git (格式git@gitlab.com/MYPROJECT.git是SSH存储库URL的缩写)。 您收到的错误...

permissions denied (publickey).
fatal: Could not read from remote repository

...建议,如您所料,您在本地没有合适的ssh私钥。 有几种方法可以解决此问题:

  • 使用诸如scp东西将私钥复制到新主机上。
  • 使用复制和粘贴将私钥转移到新主机。
  • 使用gitlab存储库的https URL(类似https://gitlab.com/USERNAME/PROJECTNAME.git
  • 在新主机上创建一个新的ssh密钥对,并使用复制和粘贴将公钥添加到您的github帐户。

暂无
暂无

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

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