简体   繁体   English

适用于github的Mac vs Linux(Ubuntu).ssh配置

[英]Mac vs Linux (Ubuntu) .ssh config for github

I have following configuration on Mac OS X in /Users/andi/.ssh/config : 我在Mac OS X上的/Users/andi/.ssh/config具有以下配置:

Host github
    HostName github.com
    IdentityFile "~/.ssh/githubik"
    IdentitiesOnly yes

And I easily can run easily git clone git@github:andilab/mbf.git 我可以轻松地运行git clone git@github:andilab/mbf.git

I try very same configuration on Ubunut (14.04 on EC2). 我在Ubunut上尝试了非常相同的配置(在EC2上为14.04)。 The config is in /home/ubuntu/.ssh and wwhen I run git clone git@github:andilab/mbf.git I get: 该配置在/home/ubuntu/.ssh ,当我运行git clone git@github:andilab/mbf.git我得到:

Cloning into 'mbf'...
ssh: Could not resolve hostname github: Name or service not known
fatal: Could not read from remote repository.

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

all right I know it sucks answering own questions on SO, but maybe it will help somebody. 好吧,我知道这很麻烦回答关于SO的问题,但这也许会对某人有所帮助。 I was sudo-ing on server, so the configs for ubuntu user were not considered when playing as root . 我在服务器上进行sudo-ing操作,因此以root身份播放时不考虑ubuntu用户的配置。

Solution : provide configuraiton for right user, and everything works. 解决方案 :为合适的用户提供配置,一切正常。

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

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