๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป DEV/์—ฐ๊ตฌ๋ชฉ๋ก

[Webstorm] SSH Key Passphrase ์ธ์ฆ (ํ—ค๋งค์ธ ์Šคํ† ๋ฆฌ)

by Rising Oneโ˜… 2024. 11. 22.
728x90
๋ฐ˜์‘ํ˜•
SMALL

WebStorm - JetBrains

 

 

์ ‘๊ทผ (์š”์•ฝ)

๊ฐœ๋ฐœ์„ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋˜ (IDE) IntelliJ Ultimate version ๋ง๊ณ ๋„ Webstorm์ด ๋ฌด์ƒ์ œ๊ณต๋จ(๋น„์˜๋ฆฌ)์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ JavaScript & TypeSript ์ „์šฉ ์›น ๊ฐœ๋ฐœ ํ”„๋กœ์ ํŠธ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉ์„ ํ•ด๋ณด๋ ค๋‹ค๊ฐ€, ์„ค์ •์—์„œ ํ—ค๋งค์ธ(?) ์Šคํ† ๋ฆฌ๋ฅผ ๋‹ด์Šต๋‹ˆ๋‹ค.

 

๋‘˜ ๋‹ค JetBrains์‚ฌ์—์„œ ๋‹ค๋ฃจ๋Š” IDE์ด๋‹ค ๋ณด๋‹ˆ ํ•œ ์ชฝ์˜ ํ”„๋กœ๊ทธ๋žจ์—์„œ์˜ settings ๊ฐ’๋“ค์„ ๋‹ค๋ฅธ ํ•œ ์ชฝ์˜ ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ๋ชจ๋‘ import ๋ฅผ ํ•ด์˜ฌ ์ˆ˜ ์žˆ์—ˆ๊ณ , ๊ทธ๋ ‡๊ฒŒ ์ „ ๋ฌด์‹ฌ์ฝ” settings ๊ฐ’๋“ค์„ import ๋ฅผ ํ•ด์˜ค๋ฉด์„œ ๋ชจ๋“  ๋ฌธ์ œ์˜ ์‹œ์ž‘์ด ์žˆ์—ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

WebStorm ๋‚ด VCS์— Github ๊ณ„์ •์ด token์œผ๋กœ ๋กœ๊ทธ์ธ์ด ๋˜์–ด์žˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ ,

ํ”„๋กœ์ ํŠธ clone์„ ์œ„ํ•ด rsa(SSH key)๋ฅผ ๋ช…ํ™•ํžˆ ์ž…๋ ฅํ•ด๋„ clone์ด fail๋˜๋Š” ์ƒํ™ฉ

 

์šฐํšŒํ•˜์—ฌ, terminal ๋ช…๋ น์–ด ์ž…๋ ฅ์œผ๋กœ clone์„ ๋ฐ›๊ณ ์ž SSH ํ˜•์‹์˜ url์„ copyํ•ด clone์€ ์„ฑ๊ณตํ•ด๋„

ํ”„๋กœ์ ํŠธ ๋‚ด ๋ณ€๊ฒฝ์ด๋ ฅ์„ push ํ•˜๋ คํ•ด๋„ push failed ๋˜๋Š” ์ƒํ™ฉ

 

๋ฌด์–ธ๊ฐ€ ํ•œ ๊ฐ€๋“ ๋ฐฉํ•ด๋ฐ›๊ณ , ๋ง‰ํ˜€์žˆ๋Š” ๋“ฏํ•œ ๋Š๋‚Œ์„ ์คฌ์Šต๋‹ˆ๋‹ค. 

๋ฌด์—‡์ด ๋ฌธ์ œ์ธ์ง€ ์•Œ ๊ฒƒ ๊ฐ™์œผ๋ฉด์„œ๋„ ๋ชจ๋ฅด๊ฒ ๋Š” ์ด ์ƒํ™ฉ์„ ํ’€์–ด๋‚˜๊ฐ„ ์Šคํ† ๋ฆฌ๋ฅผ ์ ์–ด ๋‚ด๋ ค๊ฐ‘๋‹ˆ๋‹ค.

๋„์›€์ด ๋˜๋Š” ๋ถ€๋ถ„์—์„œ ํ•ด๊ฒฐ์„ ๋ณด์‹œ๊ธธ ์‘์›ํ•ฉ๋‹ˆ๋‹ค!

  

 

 

 

  1. ๊ณ ๋ง™์ง€๋งŒ ๋ฏธ์› ๋˜, import 

 

  2. ์—๋Ÿฌ ๋ฐœ์ƒ์˜ ์‹œ์ž‘ ()

      (2.1). Permission denied

      (2.2). Auto Fetch Fail

      (2.3). Push Failed

 

  3. ์ด๊ฑด ์™œ ์•ˆ๋ผ? (์›๊ฒฉ ์ €์žฅ์†Œ๋กœ์˜ push)

      (3.1). git push --set-upstream origin ๋ธŒ๋žœ์น˜๋ช…

      (3.2). IDE VCS

 

  4.  IDE setting ์ˆ˜์ •

      (4.1)  Preferences (๋˜๋Š” Settings) > Tools > SSH Configurations

      (4.2)  Preferences (๋˜๋Š” Settings) > Appearance & Behavior > System Settings > Passwords๋กœ ์ด๋™

      

  5. ํ•ด์†Œ

      (5.1). ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ํ›„ SSH key๋ฅผ ์žฌ์ฐจ ํ™•์ธ


๋ฐฉ๋ฒ•

   1. ๊ณ ๋ง™์ง€๋งŒ ๋ฏธ์› ๋˜, import 

์ œํ’ˆ ๋‚ด import settings ์„ ๋„์™€์ฃผ๋Š” JetBrains

 

IntelliJ Ultimate IDEA์—์„œ ์‚ฌ์šฉํ–ˆ๋˜ settings ๊ฐ’์„ ๊ทธ๋Œ€๋กœ "import settings" ํ•ด์ฃผ๊ฒ ๋‹ค๋Š” WebStorm ๊ณผ์˜ ์ฒซ๋งŒ๋‚จ.

์ด๊ฒƒ์ด '์œ ๋ฃŒ IDEA Tool์„ ์‚ฌ์šฉํ•˜๋Š” ๋˜๋‹ค๋ฅธ ์ด์œ  ์ค‘ ํ•˜๋‚˜๊ฒ ๊ตฌ๋‚˜' ์ƒ๊ฐํ•˜๋ฉฐ ์•„๋ฌด๋Ÿฐ ์˜์‹ฌ์—†์ด ์ง„ํ–‰.

 


  2. ์—๋Ÿฌ ๋ฐœ์ƒ์˜ ์‹œ์ž‘ 

      (2.1). Permission denied

      (2.2). Auto Fetch Fail

      (2.3). Push Failed

๋ฌธ์ œ์˜ ์—๋Ÿฌ..

 

โœ… github ํ”„๋กœ์ ํŠธ์˜ ๊ถŒํ•œ์„ maintain => admin ์œผ๋กœ ์ˆ˜์ • (maintain  role๋„ ๊ดœ์ฐฎ์•˜๋˜ ๊ฒƒ..!)

โœ… ๋‹ค์–‘ํ•œ ๋ช…๋ น์–ด ํ™•์ธ ๊ณผ์ • 

 

eval $(ssh-agent -s)

>> Agent pid 85005

 

ssh -T git@github.com

>> Hi OOOO, 


  3. ์ด๊ฑด ์™œ ์•ˆ๋ผ? (์›๊ฒฉ ์ €์žฅ์†Œ๋กœ์˜ push)

      (3.1). git push --set-upstream origin ๋ธŒ๋žœ์น˜๋ช…

      (3.2). IDE VCS

 

๋‹ค์–‘ํ•œ ํ…Œ์ŠคํŠธ ์ค‘, ์›๊ฒฉ ์ €์žฅ์†Œ๋กœ์˜ Push ๋ฅผ ์œ„ํ•ด์„œ 2๊ฐ€์ง€ ๋ฐฉ๋ฒ• ์ด์šฉ

 

1. ๋ช…๋ น์–ด ์ž…๋ ฅ => Push ์ง„ํ–‰ ๋จ

git push --set-upstream origin ๋ธŒ๋žœ์น˜๋ช…

 

 

2. VCS ์‚ฌ์šฉ => Push Failed

- ๋ช…ํ™•ํ•œ rsa passphrase๋ฅผ ์ž…๋ ฅํ•ด๋„ push failed๊ฐ€ ๋‚ฌ๋˜ ๊ฒƒ

๋‹จ์ถ•ํ‚ค : command + k

 

1) ์›น์Šคํ†ฐ์—์„œ VCS ๋ฅผ ํ†ตํ•ด command+k ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ commit and push๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด ์•„๋ž˜ ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜ค๋Š”๋ฐ Push failed git@github.com: Permission denied (publickey). Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 2) ๋˜, commit ํ•œ ํ›„์—, git push --set-upstream origin feature/BTMS_RF0017 ์ด ๋ช…๋ น์–ด๋กœ push๋ฅผ ํ•˜๋ฉด rsa์˜ passphrase๋ฅผ ์š”๊ตฌํ•˜๋ฉด์„œ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž…๋ ฅ ํ›„ ์›๊ฒฉ์ €์žฅ์†Œ์— push๊ฐ€ ๋ผ. ๋‚œ ์ •ํ™•ํ•œ passphrase๋ฅผ ์ž…๋ ฅํ•˜๋Š”๋ฐ ์™œ 1) ๋ฐฉ์‹์—์„œ๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚ ๊นŒ?

 

==> ์ฃผ๋กœ SSH ์—์ด์ „ํŠธ์™€ WebStorm์˜ ์ธ์ฆ ์„ค์ • ์ฐจ์ด ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

  • ํ„ฐ๋ฏธ๋„์—์„œ git push๋ฅผ ์‹คํ–‰ํ•  ๋•Œ๋Š” SSH ์—์ด์ „ํŠธ๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด, SSH ํ‚ค์™€ passphrase๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
  • WebStorm์—์„œ VCS ์‚ฌ์šฉ ์‹œ์—๋Š” SSH ์—์ด์ „ํŠธ๊ฐ€ ์ œ๋Œ€๋กœ ์„ค์ •๋˜์ง€ ์•Š์•˜๊ฑฐ๋‚˜, WebStorm์ด ์ œ๋Œ€๋กœ๋œ SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„์„œ Permission denied (publickey) ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ด๋•Œ SSH ํ‚ค ์ธ์ฆ์— ์‹คํŒจํ•˜๊ณ , git@github.com: Permission denied ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

1. WebStorm์—์„œ SSH ์—์ด์ „ํŠธ ์„ค์ • ํ™•์ธ

WebStorm์ด SSH ์—์ด์ „ํŠธ๋ฅผ ์ œ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ WebStorm์ด SSH ํ‚ค๋ฅผ ์ฐพ์ง€ ๋ชปํ•˜๋ฉด, ์ธ์ฆ์„ ์œ„ํ•ด passphrase๋ฅผ ์š”์ฒญํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

WebStorm์—์„œ SSH ์„ค์ •์„ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•:

  • Preferences > Version Control > Git์œผ๋กœ ๊ฐ€์„ธ์š”.
  • Path to Git executable์—์„œ git์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์ •๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  • Use credential helper๊ฐ€ ์ฒดํฌ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”. ์ด ์„ค์ •์ด GitHub๊ณผ์˜ ์ธ์ฆ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2. WebStorm์—์„œ SSH ํ‚ค๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์‚ฌ์šฉํ•˜๋Š”์ง€ ํ™•์ธ

WebStorm์€ ๋•Œ๋•Œ๋กœ ๋กœ์ปฌ ํ™˜๊ฒฝ์˜ SSH ์—์ด์ „ํŠธ๋ฅผ ์ œ๋Œ€๋กœ ์ธ์‹ํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์€ WebStorm์—์„œ ์ง์ ‘ SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

  1. WebStorm์—์„œ Preferences (๋˜๋Š” Settings) > Tools > SSH Configurations๋กœ ๊ฐ€์„ธ์š”.
  2. GitHub์— ์—ฐ๊ฒฐ๋œ SSH ํ‚ค๊ฐ€ ์ œ๋Œ€๋กœ ์„ค์ •๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ์ด ์„ค์ •์„ ํ†ตํ•ด WebStorm์ด ์‚ฌ์šฉํ•˜๋Š” SSH ํ‚ค๋ฅผ ํ™•์ธํ•˜๊ณ , ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

3. SSH ์—์ด์ „ํŠธ ๋ฌธ์ œ ํ•ด๊ฒฐ

WebStorm์ด SSH ์—์ด์ „ํŠธ์™€ ์ œ๋Œ€๋กœ ์—ฐ๋™๋˜์ง€ ์•Š์•„์„œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š”, SSH ์—์ด์ „ํŠธ๊ฐ€ ์‹คํ–‰ ์ค‘์ธ์ง€ ํ™•์ธํ•˜๊ณ , WebStorm์— SSH ํ‚ค๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์—ฐ๊ฒฐํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • ํ„ฐ๋ฏธ๋„์—์„œ SSH ์—์ด์ „ํŠธ๊ฐ€ ํ™œ์„ฑํ™” ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋ ค๋ฉด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด๋ณด์„ธ์š”:์ด ๋ช…๋ น์–ด๋Š” SSH ์—์ด์ „ํŠธ๋ฅผ ์‹œ์ž‘ํ•˜๊ณ , ํ•ด๋‹น ํ‚ค๋ฅผ SSH ์—์ด์ „ํŠธ์— ์ถ”๊ฐ€ํ•˜๋Š” ๋ช…๋ น์ž…๋‹ˆ๋‹ค.
  • bash
    ์ฝ”๋“œ ๋ณต์‚ฌ
    eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
  • WebStorm์„ ๋‹ค์‹œ ์‹œ์ž‘ํ•œ ํ›„, VCS -> Git -> Commit and Push๋ฅผ ๋‹ค์‹œ ์‹œ๋„ํ•ด ๋ณด์„ธ์š”.

4. WebStorm์˜ Git ์ธ์ฆ ์„ค์ • ์žฌ์„ค์ •

WebStorm์—์„œ GitHub ์ธ์ฆ ์ •๋ณด๋ฅผ ์žฌ์„ค์ •ํ•˜๋Š” ๊ฒƒ๋„ ๋ฐฉ๋ฒ•์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. WebStorm์—์„œ ์ธ์ฆ ์ •๋ณด๋ฅผ ์‚ญ์ œํ•˜๊ณ , ๋‹ค์‹œ ์ธ์ฆ ์ ˆ์ฐจ๋ฅผ ์ง„ํ–‰ํ•ด ๋ณด์„ธ์š”.

  1. Preferences (๋˜๋Š” Settings) > Appearance & Behavior > System Settings > Passwords๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  2. In KeePass๋‚˜ Native Keychain์„ ์„ ํƒํ•˜๊ณ , ์ €์žฅ๋œ GitHub ์ธ์ฆ ์ •๋ณด๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.
  3. ๋‹ค์‹œ WebStorm์„ ์žฌ์‹œ์ž‘ํ•˜๊ณ , GitHub์— ๋Œ€ํ•œ ์ธ์ฆ ์ •๋ณด๋ฅผ ์ƒˆ๋กœ ์ž…๋ ฅํ•ด ๋ณด์„ธ์š”.

5. GitHub์—์„œ SSH ํ‚ค ํ™•์ธ

WebStorm์—์„œ ์‚ฌ์šฉํ•˜๋Š” SSH ํ‚ค๊ฐ€ GitHub์— ์ œ๋Œ€๋กœ ๋“ฑ๋ก๋˜์—ˆ๋Š”์ง€ ๋‹ค์‹œ ํ•œ๋ฒˆ ํ™•์ธํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์€ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ SSH ํ‚ค๊ฐ€ GitHub ๊ณ„์ •์— ๋“ฑ๋ก๋˜์ง€ ์•Š์•˜๋‹ค๋ฉด Permission denied (publickey) ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • GitHub SSH Key ๋“ฑ๋ก์„ ํ™•์ธํ•˜๋ ค๋ฉด:
    • GitHub์— ๋กœ๊ทธ์ธํ•œ ํ›„, Settings > SSH and GPG keys์—์„œ ๋“ฑ๋ก๋œ SSH ํ‚ค ๋ชฉ๋ก์„ ํ™•์ธํ•˜์„ธ์š”.
    • WebStorm์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํ‚ค์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ , ํ‚ค๊ฐ€ ๋“ฑ๋ก๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•ด ์ฃผ์„ธ์š”

 

  4. IDE setting ์ˆ˜์ •

      (4.1)  Preferences (๋˜๋Š” Settings) > Tools > SSH Configurations

      (4.2)  Preferences (๋˜๋Š” Settings) > Appearance & Behavior > System Settings > Passwords๋กœ ์ด๋™

 

(4-1) ๊ธฐ์กด์— ์ถ”๊ฐ€ ๋˜์–ด์žˆ๋˜ ๊ฒƒ ์ œ๊ฑฐ (import๋กœ ํ•จ๊ป˜ ๋„˜์–ด์˜จ ์„ค์ • ๊ฐ’์ด ์žˆ์—ˆ๋‹ค)

 

(4-2) ๊ธฐ์กด์˜ ์ฒดํฌ ๋œ keyChain์ด ์•„๋‹ˆ๋ผ, "Do not save, Forget passwords after restart" ์ฒดํฌ!

 

  5. ํ•ด์†Œ

      (5.1). ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ํ›„ SSH key๋ฅผ ์žฌ์ฐจ ํ™•์ธ

 

 

ํ•ด์†Œ๋œ ์ดํ›„, ์žฌ์‹คํ–‰์‹œํ‚จ WebStorm์ด ๋ฐ˜๊ฒจ์ฃผ๋ฉฐ ๋‚ด๋†“์€ ๊ฒƒ!

(rsa SSH key๋ฅผ ์žฌ์ž…๋ ฅํ•˜๋„๋ก ํ•˜๋Š” ๊ฒƒ!)

 

 

728x90
๋ฐ˜์‘ํ˜•
LIST

๋Œ“๊ธ€