访问存储库与ssh [英] access repository with ssh

查看:105
本文介绍了访问存储库与ssh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我发现了git等东西的存在。我需要通过ssh.I访问远程存储库,命令 $ git clone git@forest.com:stranger@gmail.com code>。但是,当我使用这个,它说它是克隆,然后需要密码。虽然我在〜/ .ssh中有密钥和pub keys,并且我有一个配置文件,如下所示:

 主机林
用户git
HostName forest.com
端口22
IdentityFile〜/ .ssh /< stranger@gmail.com> .key

你可以给我一个提示,我怎样才能访问这个远程仓库,为什么我需要这个配置文件,我该怎么做因为你的密钥没有标准名称,你需要使用你的配置文件。

解决方案

但确切的网址是:

  git clone forest:yourRepo 

forest 引用〜/中的Host条目。 ssh / config 文件,该文件将为ssh提供正确的用户,主机名,端口和私钥文件。

YourRepo 应该是您要克隆的回购商的名称或完整路径。

我怀疑您的回购是否不适用med stranger@gmail.com






其他问题是:


  • 配置文件的名称

    不需要扩展名: 〜/ .ssh / config 。其他任何东西都会被ssh忽略。


  • 您的私钥的名称

    我强烈建议避免使用' @ '在其中,使用完整路径 /home/myName/.ssh/myKey /home/myName/.ssh/myKey.pub (用于私钥和公钥)。
    然后你的 IdentityFile 应该引用密钥而不带任何扩展名: /home/myName/.ssh/myKey :这是私有密钥向公众开放: /home/myName/.ssh/myKey.pub )。



Yesterday I found out about existence of such thing as git.I need to access a remote repository with ssh.I used command $ git clone git@forest.com:stranger@gmail.com. But when I use this , it says it's cloning and then requires a password. Though I have secret and pub keys in ~/.ssh.And also I have a config file, that looks like this:

Host forest
    User git
    HostName forest.com
    Port 22
    IdentityFile ~/.ssh/<stranger@gmail.com>.key

Can you ppl give me a tip, how can I access this remote repository and why I need this config file, and what can I do with it?

解决方案

Since your key has no standard name, you need to use your config file.
But the exact url for that would be:

git clone forest:yourRepo

The key "forest" reference the Host entry in your ~/.ssh/config file, which will provide ssh with the right user, hostname, port and private key file to use.

YourRepo should be the name or the full path of the repo you want to clone.
I doubt your repo is named stranger@gmail.com.


The other issues are:

  • the name of the config file:
    no extension needed: ~/.ssh/config only. Anything else will be ignored by ssh.

  • the name of your private key:
    I strongly suggests avoiding the '@' in it, and using a full path: /home/myName/.ssh/myKey and /home/myName/.ssh/myKey.pub (for private and public keys).
    Then your IdentityFile should reference the key without any extension: /home/myName/.ssh/myKey: that is the private one (as opposed to the public one: /home/myName/.ssh/myKey.pub).

这篇关于访问存储库与ssh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆