์–ด๋–ป๊ฒŒ"<unk>!๐Ÿคซ"๋‹น์‹ ์˜GitHub ๊ณ„์ •์— ๋“ค์–ด๊ฐ€์„ธ์š”.

5683 ๋‹จ์–ด tutorialgithubbeginnersopensource

์˜์‚ฌ ์ผ์ •

  • ์†Œ๊ฐœ
  • SSH ํ‚ค๋ž€?
  • SSH ํ‚ค ์ƒ์„ฑ
  • GitHub์— ๊ณต์šฉ SSH ํ‚ค ์ „๋‹ฌ
  • SSH ์—ฐ๊ฒฐ ํ…Œ์ŠคํŠธ
  • ๊ฒฐ๋ก 
  • ๋จธ๋ฆฌ๋ง.


    GitHub์—์„œ ์ž์‹ ์˜ ์‹ ๋ถ„์„ ํ™•์ธํ•ด์•ผ ํ•  ๋•Œ๋งˆ๋‹ค ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ œ๊ณตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์‹ฌ์‹ฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๊นŒ?๊ทธ๋ž˜, ์ ์›, ๋„ˆ๋Š” ๋ชจ๋“  ์•”ํ˜ธ ๊ฒ€์ฆ์„ ํ†ตํ•ด ๋„ˆ ์ž์‹ ์„ ์‹๋ณ„ํ•˜๋Š” ๋ฒˆ๊ฑฐ๋กœ์›€์„ ๊ฒช์„ ํ•„์š”๊ฐ€ ์—†๋‹ค.๋ณธ๊ณ ์—์„œ ๋‹น์‹ ์€ ์•”ํ˜ธ๊ฐ€ ์—†๋Š” ์‹ ๋ถ„ ์‹๋ณ„ ๋ฐฉ๋ฒ•์„ ๋ฐฐ์šธ ๊ฒƒ์ž…๋‹ˆ๋‹ค.๋งค๋ฒˆ ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์‚ฌ์šฉํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค.์ด ๋ฌธ์žฅ์„ ๋”ฐ๋ผ ๊ทธ๊ฒƒ์ด ์–ด๋–ป๊ฒŒ ์™„์„ฑ๋˜์—ˆ๋Š”์ง€ ์ดํ•ดํ•˜๋‹ค.
    ๋ณธ๊ณ ์˜ ์ค‘์ ์€ SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ GitHub์— ๋Œ€ํ•œ ์ธ์ฆ์„ ํ•˜๋Š” ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ๊ฐ€๋ฅด์น˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

    SSH ํ‚ค๋ž€?


    SSH ํ‚ค๊ฐ€ ๋ฌด์—‡์ธ์ง€ ์ดํ•ดํ•˜๋ ค๋ฉด ๋จผ์ € SSH๋ผ๊ณ  ํ•˜๋Š” ๋ณด์•ˆ ์…ธ์„ ์•Œ์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด SSH๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‘ ๋…ธ๋“œ(ํด๋ผ์ด์–ธํŠธ์™€ ํ˜ธ์ŠคํŠธ) ์‚ฌ์ด์— ์‚ฌ์šฉ๋˜๋Š” ์•ˆ์ „ํ•œ ํ†ต์‹  ๋ฐฉ์‹์ด๋‹ค.SSH๋Š” ํ†ต์‹  ๋งํฌ์— ์‚ฌ์šฉ๋˜๋Š” ๋ณด์•ˆ ํ†ต์‹  ํ”„๋กœํ† ์ฝœ์ž…๋‹ˆ๋‹ค.์ด ๊ฒฝ์šฐ GitHub์€ ํ˜ธ์ŠคํŠธ์ด๊ณ  PC๋Š” ํด๋ผ์ด์–ธํŠธ์ž…๋‹ˆ๋‹ค.
    PC(ํด๋ผ์ด์–ธํŠธ) ๋ฐ GitHub(ํ˜ธ์ŠคํŠธ)๋Š” ์ด ๋ณด์•ˆ SSH ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ์•”ํ˜ธ ์—†์ด ์•ˆ์ „ํ•˜๊ฒŒ ์ธ์ฆํ•ฉ๋‹ˆ๋‹ค.
    ๊ทธ๋Ÿฌ๋‚˜ ๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ SSH ํ‚ค๋ž€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?
    ์‹ ๋ฐœ์ฒ˜๋Ÿผ SSH ํ‚ค๊ฐ€ ์Œ์œผ๋กœ ๋‚˜ํƒ€๋‚˜๊ณ  ํ•˜๋‚˜์˜ ๊ณต๊ฐœ ํ‚ค์™€ ํ•˜๋‚˜์˜ ๊ฐœ์ธ ํ‚ค๋กœ ๊ตฌ์„ฑ๋˜์–ด ํ•˜๋‚˜์˜ ๊ณต์‚ฌ SSH ํ‚ค ์Œ์„ ํ˜•์„ฑํ•œ๋‹ค.SSH ํ‚ค๋Š” SSH ํ”„๋กœํ† ์ฝœ์˜ ๋ณด์•ˆ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ์ค‘์š”ํ•œ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค.SSH ํ”„๋กœํ† ์ฝœ์€ ๋น„๋Œ€์นญ ์•”ํ˜ธํ™”๋ฅผ ๋ณด์•ˆ ๊ธฐ๋ฐ˜์œผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.๊ทธ๋Ÿฐ ๋‹ค์Œ SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ”„๋กœํ† ์ฝœ์„ ์•”ํ˜ธํ™”ํ•˜๊ณ  ๋ณตํ˜ธํ™”ํ•ฉ๋‹ˆ๋‹ค.
    ๊ทธ๋ž˜, ๋” ์ด์ƒ ์žก๋‹ดํ•˜์ง€ ๋งˆ๋ผ.SSH ํ‚ค ์Œ์„ ๋งŒ๋“ค ๋•Œ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

    SSH ํ‚ค ์ƒ์„ฑํ•˜๊ธฐ;


    ์ƒˆ SSH ํ‚ค ์Œ์„ ์ƒ์„ฑํ•˜๋ ค๋ฉด ํ„ฐ๋ฏธ๋„์—์„œ ์•„๋ž˜ ๋ช…๋ น์„ ๋ณต์‚ฌํ•˜๊ณ  ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.
    ssh-keygen -t rsa -b 4096 -C 'Your_Email_Address'
    
  • enter ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด "์•”ํ˜ธ ๋‹จ์–ด"๋ฅผ ์ž…๋ ฅํ•˜๋Š” ์•Œ๋ฆผ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์•”ํ˜ธ ๋‹จ์–ด๋Š” ๊ฐ•์ œ์„ฑ์ด ์•„๋‹ˆ๋‹ค.๋‹จ, ๊ฐœ์ธ ํ‚ค๊ฐ€ ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋˜์ง€ ์•Š์€ ์‚ฌ์šฉ์„ ๋ณดํ˜ธํ•˜๊ธฐ ์œ„ํ•ด ์•”ํ˜ธ๋ฅผ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. (enter ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ด ๋™์ž‘์„ ์ž ์‹œ ๊ฑด๋„ˆ๋›ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.)
  • ์ถ•ํ•˜ํ•ฉ๋‹ˆ๋‹ค. ์œ„์˜ ๋ช…๋ น์€ SSH ํ‚ค ์Œ์„ ์ƒ์„ฑํ•˜์—ฌ ํŠน์ • ๊ฒฝ๋กœ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.์ด ์—ด์‡ ๋Š” rsaํ˜•์ด๋‹ค.

    Note;
    -t refers to SSH key type (in this case we're using the rsa SSH key type).
    -b refers to size of SSH key in bits. The minimum bit length is 768 bits and the default length is 2048 bits. So in the command above you're setting the SSH key to a size of 4096 bits.


    GitHub์— ๊ณต์šฉ SSH ํ‚ค ์ „๋‹ฌ;


    SSH ํ‚ค ์Œ ์ค‘ GitHub์— ํ‚ค๊ฐ€ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.๊ณต๊ฐœ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.๋‹ค๋ฅธ ํ‚ค๋Š” ๊ฐœ์ธ ํ‚ค์ž…๋‹ˆ๋‹ค. ssh ์—์ด์ „ํŠธ๋ผ๋Š” ํ”„๋กœ๊ทธ๋žจ์— ์ €์žฅํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

    "The ssh-agent is a helper program that keeps track of usersโ€™ identity keys and their passphrases. The agent can then use the keys to log into other servers without having the user type in a password or passphrase again. This implements a form of single sign-on (SSO)." read more from SSH Academy


    ssh ํ”„๋ก์‹œ๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜ ๋ช…๋ น์„ ๋ถ™์—ฌ๋„ฃ๊ธฐ;
    eval `ssh-agent -s`
    
    ์™„์„ฑ
    ์ข‹์Šต๋‹ˆ๋‹ค. ํ˜„์žฌ ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ๊ฐœ์ธ SSH ํ‚ค๋ฅผ SSH ์—์ด์ „ํŠธ์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    ssh-add ~/.ssh/id_rsa
    
    ๊ฒฝํƒ„ํ•  ๋งŒํ•œ!

    Note;
    The public rsa SSH key filename id_rsa.pub has a .pub extension and the private has no extension.


    ๊ธฐ์–ตํ•ด๋ผ, ๋„ˆ๋Š” GitHub์—๊ฒŒ ๋„ˆ์˜ ๊ณต๊ฐœ ํ‚ค๋ฅผ ์ฃผ์–ด์•ผ ํ•œ๋‹ค.๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ๊ณต์šฉ SSH ํ‚ค๋ฅผ ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.
    ์šฐ์˜
    pbcopy < ~/.ssh/id_rsa.pub 
    
    ์ฐฝ๋ฌธ
    clip < ~/.ssh/id_rsa.pub 
    
    ํ˜„์žฌ, ํ‚ค๋ฅผ GitHub ๊ณ„์ •์— ๋ถ™์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.๊ณ„์ •์— ๋กœ๊ทธ์ธํ•œ ๋‹ค์Œ ๋‹ค์Œ ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค.
    1. ์„ค์น˜;
    GitHub์— ๋กœ๊ทธ์ธํ•œ ํ›„ ํ™”๋ฉด ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์— ์žˆ๋Š” ๊ณ„์ • ์ด๋ฏธ์ง€๋ฅผ ํด๋ฆญํ•˜์‹ญ์‹œ์˜ค.๋“œ๋กญ๋‹ค์šด ๋ชฉ๋ก์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
    ์ด์ œ ๋ฐ‘์— ์žˆ๋Š” ๋ฉ”๋‰ด์˜ ์„ค์ •์„ ํด๋ฆญํ•˜์„ธ์š”.

    2๋‹จ๊ณ„ - SSH ๋ฐ GPG ํ‚ค.
    ์„ค์ •์˜ ์™ผ์ชฝ์— ๋ฉ”๋‰ด๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.์™ผ์ชฝ ๋ฉ”๋‰ด์—์„œ SSH ๋ฐ GPG ํ‚ค ํƒญ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.๋‹น์‹ ์€ ์•„๋ž˜์˜ ์ด๋Ÿฐ ํŽ˜์ด์ง€๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ด ํŽ˜์ด์ง€์—์„œ New SSH Key ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.์ด ๋‹จ์ถ”๋Š” ๊ณต์šฉ SSH ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ํŽ˜์ด์ง€๋กœ ๋ฐฉํ–ฅ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.
    ๋‹ค์Œ ๋‹จ๊ณ„๋กœ ์ด๋™ํ•˜์‹ญ์‹œ์˜ค.
    3๋‹จ๊ณ„ - ๊ณต์šฉ SSH ํ‚ค๋ฅผ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.
    ์ด์ œ ๊ณต๊ฐœ ํ‚ค๋ฅผ GitHub์— ์ „๋‹ฌํ•  ๋•Œ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
    ๋‹ค์Œ์€ ๋‹น์‹ ์ด ํ•ด์•ผ ํ•  ์ผ์ž…๋‹ˆ๋‹ค.
  • ์—๋Š” ์ œ๋ชฉ ํ…์ŠคํŠธ ์ƒ์ž๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.์„ ํƒํ•œ SSH ํ‚ค ์ œ๋ชฉ์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  • ํ„ฐ๋ฏธ๋„์—์„œ ํด๋ฆฝ๋ณด๋“œ๋กœ ๋ณต์‚ฌํ•œ ๊ณต์šฉ SSH ํ‚ค๋ฅผ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.
  • ๋งˆ์ง€๋ง‰์œผ๋กœ AddSSHKey ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  • 4. ํ™•์ธ
    GitHub์—์„œ ํ™•์ธ์„ ์œ„ํ•ด ์•”ํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๊ณ„์†ํ•˜์„ธ์š”.

    ์™„์„ฑ
    SSH์™€ GPG ํ‚ค ํŽ˜์ด์ง€์— ์ถ”๊ฐ€๋œ SSH ํ‚ค ๋ชฉ๋ก์„ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

    ์ผ์„ ๋๋‚ด๋‹ค


    ์—ฐ๊ฒฐ์„ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ๋งˆ์ง€๋ง‰ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์‹ญ์‹œ์˜ค.
    ssh -T [email protected]
    
    ๋„ˆ๋Š” ์•„๋ž˜์™€ ์œ ์‚ฌํ•œ ๊ฒฐ๊ณผ๋ฅผ ์–ป์–ด์•ผ ํ•œ๋‹ค.

    ์ž˜ํ–ˆ์–ด!
    ์ด์ œ ์ƒˆ SSH ํ‚ค๋กœ ์‹œ์šด์ „์„ ์‹œ์ž‘ํ•ด ๋ณผ๊นŒ์š”?
    ์ด GitHub repo ๋กœ ์ด๋™ํ•ด์„œ ๋ฆฌํฌ์˜ SSH ๋งํฌ๋ฅผ ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

    ํ˜„์žฌ ํ„ฐ๋ฏธ๋„์—์„œ ๋ช…๋ น ์ž…๋ ฅํ•˜๊ธฐ;
    git clone "paste_in_the_copied_SSH_repo_link_without_qoutes"
    
    ๊ทธ๋Ÿฐ ๋‹ค์Œ Enter ํ‚ค๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค.์œ„ ์ฝ”๋“œ๋Š” SSH ์—ฐ๊ฒฐ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฆฌํฌ๋ฅผ ๋ณต์ œํ•ฉ๋‹ˆ๋‹ค.
    ์ œ ์นœ๊ตฌ๋Š” GitHub SSH ํ‚ค์˜ ํ•œ ์˜ˆ์ž…๋‹ˆ๋‹ค.
    ๊ฒฐ๋ก 
    ์ž˜ํ–ˆ์–ด!Github ๊ตฌ์„ฑ ํŒŒ์ผ์— ์ƒˆ SSH ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.๋” ์ฝ๊ธฐ ์œ„ํ•ด ์ €๋Š” ๋ณธ๋ฌธarticle์„ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ SSH์— ๋Œ€ํ•œ ๊นŠ์€ ์—ฐ๊ตฌ์ž…๋‹ˆ๋‹ค.๋งŒ์•ฝ ๋‹น์‹ ์—๊ฒŒ ๋ฌด์Šจ ๋ฌธ์ œ๊ฐ€ ์žˆ์œผ๋ฉด ์–ธ์ œ๋“ ์ง€ ์ €์—๊ฒŒ ์ „ํ™”ํ•˜์„ธ์š”.
    ์šฐ๋ฆฌ ๋‹ค์‹œ ๋งŒ๋‚  ๋•Œ๊นŒ์ง€, ์ ์›.

    ์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ