7 months ago

首先用 PuTTYgen Release 0.70 來產生公私鑰
有需要就從這邊下載 https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

key type 選 RSA


產生之後把 public key 視窗內的公鑰直接可以設定在 bitbucket 個人帳戶 或 Team 或 repository 上的 SSH KEY,
repository 的是叫 Access keys 是 read-only

然後 在 PuTTYgen 上輸入 key passphrase 後 儲存 private key, 然後用 PuTTYgen 的功能選單 Conversions Export OpenSSH Key 轉一下成 SSH 的公鑰

好了之後 在 Spring Config Server 上的配置

application.yml

server:
  port: ${PORT:8888}

spring:
  cloud:
    config:
      server:
        git:
          ignore-local-ssh-settings: true
          uri: git@bitbucket.org:abc/abc-repo.git
          passphrase: 剛剛輸入的密碼
          private-key: |
                      -----BEGIN RSA PRIVATE KEY 私鑰檔案完整內容-----
                      Proc-Type: 4,ENCRYPTED
                      DEK-Info: DES-EDE3-CBC,7D364AB210BACFC8

                      tuvK1rKfWd3+9lfNonoRW2tRedmSM/zlIrzcD1Tj4Yr2Qk6JvkI0IkylJKpNh/zU
                      JPmIAnl7G/kUNp8C1JQV9l5RqeJMPCN4p82Q/e6nf67Jqk9ym4EYEtU7IQSFa2ke
                      ogKnIPl/EHbBPxlW8Cp9uh4XSHEty1WYHXD96Xan/iQPXrc8ocmgccRKQPlpqyk7
                      62VRNDbDqTm6STrwplYsgaFsHg0qlGqdME/r+xnm3h2OMhp5AGFkg6ZYUTHZf6v+
                      ... 略
                      -----END RSA PRIVATE KEY-----

測試一下是否正常存取

curl -X GET \
  http://localhost:8888/askask-discovery/default
{
    "name": "askask-discovery",
    "profiles": [
        "default"
    ],
    "label": null,
    "version": "897647a23dc3f2054598af1248e4830a33730dda",
    "state": null,
    "propertySources": []
}

就先這樣吧

← MySQL8 Authentication plugin Change ssh 問題 REMOTE HOST IDENTIFICATION HAS CHANGED →
 
comments powered by Disqus