markdown 如何配置ssh配置以使多个私有github依赖关系具有多个部署密钥和自动部署。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何配置ssh配置以使多个私有github依赖关系具有多个部署密钥和自动部署。相关的知识,希望对你有一定的参考价值。

### Setup your local git config

1. [Generate a new SSH key and add it to your GitHub account](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)
   
   
2. Open your SSH config located in ~/.ssh/config and add the follwing lines:

```
  Host *.github.com
    AddKeysToAgent yes
    UseKeychain yes
    User git
    HostName github.com   
``` 

### Add a private github depencency and setup the deploy key on the server

The following instructions demonstrates how to add the private 'hello-world repository to your project.

#### 1 Add a deploy key for your server to the 'hello-world' repository

[Generate a new deploy key on your server and add it to the desired repository](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys)

#### 2 Setup your SSH config on the server

Open your SSH config file located in ~/.ssh/config and add the following lines:

```
Host hello-world.github.com
    User git
    HostName github.com
    IdentityFile ~/.ssh/DEPLOY_KEY_NAME
```

#### 3 Add the 'hello-world' repository dependency to your project 

To add the private repository 'hello-world' to your project add the following dependency to your package.json:

```
"dependencies": {
    ...
   "hello-world": "git+ssh://hello-world.github.com/hello-world.git#RELEASE_VERSION
}
```

以上是关于markdown 如何配置ssh配置以使多个私有github依赖关系具有多个部署密钥和自动部署。的主要内容,如果未能解决你的问题,请参考以下文章

markdown 如何使用SSH密钥验证而不是密码验证来“获取”私有存储库。

markdown 如何使用SSH密钥验证而不是密码验证来“获取”私有存储库。

markdown 如何使用SSH密钥验证而不是密码验证来“获取”私有存储库。

Git配置多个SSH-Key(在一台电脑上,如何配置多个SSH Key?/多个用户身份)

markdown SSH Config配置及证书登录

markdown SSH配置