๐Ÿ“

3. GitHub

ย 

1. GitHub ์„ธํŒ…

1.1. GitHub ๊ฐ€์ž…ํ•˜๊ธฐ

์•„๋ž˜ ํŽ˜์ด์ง€๋กœ ๋“ค์–ด๊ฐ€ ํšŒ์›๊ฐ€์ž…์„ ํ•ด์ฃผ์„ธ์š”! ๋ฉ”์ผ ์ธ์ฆ๊นŒ์ง€ ํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.
ย 
์›ํ•˜๋Š” ์ด๋ฉ”์ผ์„ ์ž…๋ ฅํ•˜๊ณ  Sign up for GitHub์„ ํด๋ฆญํ•˜์‹  ํ›„ ํšŒ์›๊ฐ€์ž…์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
ย 
๐Ÿ’ก
ํšŒ์› ๊ฐ€์ž… ํ›„ 4.2๋กœ ๊ฐ€์„œ token๋ฐœ๊ธ‰์„ ๋จผ์ € ์ง„ํ–‰ํ•ด์ฃผ์„ธ์š”. ํ˜„์žฌ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฆ์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
ย 

1.2. Repository ์ƒ์„ฑํ•˜๊ธฐ

๋กœ๊ทธ์ธ์ด ๋˜์—ˆ๋‹ค๋ฉด ์•„๋ž˜ Create repository๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
์ด๋ฏธ ๋งŒ๋“ค์–ด์ง„ repository๊ฐ€ ์žˆ๋‹ค๋ฉด ์•„๋ž˜์ฒ˜๋Ÿผ New๋ฅผ ํด๋ฆญํ•ด์ฃผ์„ธ์š”.
notion imagenotion image
ย 
๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์ด๋ฆ„์„ ์„ค์ •ํ•˜๊ณ  Public(๊ณต๊ฐœ)/Private(๋น„๊ณต๊ฐœ)๋ฅผ ์„ค์ •ํ•˜์‹  ํ›„, Add a README file์„ ํด๋ฆญํ•˜์—ฌ README file์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์„ค์ •์ด ์™„๋ฃŒ๋˜๋ฉด Create Repository๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
  • ๋‚˜์ค‘์— ์„ค์ • ํƒญ์—์„œ Public๊ณผ Private ์ƒํ˜ธ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • Add a README file์€ ๋ณดํ†ต ์ฒดํ‚น์„ ํ•˜์ง€ ์•Š๊ณ  ์ƒ์„ฑํ•˜์ง€๋งŒ, ๊ฐ„ํŽธํ•œ ์‹ค์Šต์„ ์œ„ํ•ด ์ฒดํ‚นํ•˜์—ฌ ์ƒ์„ฑํ•˜๊ณ  ์‹ค์Šตํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ฒดํ‚น์„ ํ•œ ๊ฒƒ๊ณผ ์ฒดํ‚น์„ ํ•˜์ง€ ์•Š์€ ๊ฒƒ 2๊ฐœ ๋ชจ๋‘ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image

1.3. GitHub์— ํŒŒ์ผ ์˜ฌ๋ฆฌ๊ธฐ

1.3.1. GUI, CLI๋ฅผ ์ด์šฉํ•˜์—ฌ GitHub์— ์˜ฌ๋ฆฌ๊ธฐ

  • Add file > Upload File > 001.html
    • notion imagenotion image
    • ์ดˆ๊ธฐ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์ƒ์„ฑ์‹œ README.md ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜์ง€ ์•Š์•˜์„ ๊ฒฝ์šฐ ํ•ด๋‹น ํ™”๋ฉด์ด ๋‚˜์˜ค์ง€ ์•Š๊ณ , ์•„๋ž˜์™€ ๊ฐ™์€ git ๋ช…๋ น์–ด๊ฐ€ ๋‚˜์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋˜‘๊ฐ™์ด git bash์— ์ž…๋ ฅํ•ด์ฃผ์‹œ๋ฉด README.mdํŒŒ์ผ์ด GitHub ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๋กœ ๋“ค์–ด๊ฐ€๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
      • ๐Ÿ’ก
        ์ด๋ฏธ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ 2๋ฒˆ์งธ ๋‚˜์˜ค๋Š” ์ฝ”๋“œ๋ฅผ ์‹คํ–‰์‹œ์ผœ์•ผ ํ•˜๋Š”๋ฐ์š”. ์ด ํŽ˜์ด์ง€ ๊ฐ€์žฅ ํ•˜๋‹จ์— ํ•ด๋‹น ๋‚ด์šฉ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
        notion imagenotion image
        notion imagenotion image
        notion imagenotion image

1.3.2. Repository ๋‚ด ํ•˜์œ„ํด๋” ์ƒ์„ฑํ•˜๊ธฐ

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋‹ค๋ณด๋ฉด ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ์˜ ๊ฐฏ์ˆ˜๊ฐ€ ๋Š˜์–ด๋‚˜๊ฒŒ ๋  ๊ฒ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋Š˜์–ด๋‚œ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๋ฅผ ์ฒด๊ณ„์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ•˜์œ„ ํด๋”์˜ ์ƒ์„ฑ์ด ํ•„์š”ํ•˜์ฃ . ํ•˜์œ„ ํด๋”๋ฅผ ์ƒ์„ฑํ•˜๊ณ ์ž ํ•˜๋Š” ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ์— ๋“ค์–ด๊ฐ„ ํ›„, ์•„๋ž˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ ํด๋”๋ฅผ ์ƒ์„ฑํ•ด ๋ด…์‹œ๋‹ค.
ย 
1) ์šฐ์ธก ์ƒ๋‹จ์˜ Add file์„ ํด๋ฆญํ•˜๊ณ  Create new file์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
ย 
2) / ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํด๋”๊ฐ€ ๋ถ„๋ฆฌ๋ฉ๋‹ˆ๋‹ค. /{ํด๋”๋ช…} ์„ ์ž…๋ ฅํ•ด์„œ ํด๋”๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
ย 
3) ๋นˆ ํด๋”๋Š” ์ƒ์„ฑ๋˜์ง€ ์•Š์•„์š”! ์ž„์˜์˜ ํŒŒ์ผ์„ ์ƒ์„ฑํ•ด์ฃผ์–ด์•ผ ์•„๋ž˜์™€ ๊ฐ™์ด commit new file ๋ฒ„ํŠผ์ด ํ™œ์„ฑํ™” ๋ฉ๋‹ˆ๋‹ค. Commit new file ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
notion imagenotion image
ย 
4) githubTest ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ์•ˆ์— test ํด๋”๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ๊ณ  ํด๋”์˜ ํ•˜์œ„์— index.html ํŒŒ์ผ์ด ์ƒ์„ฑ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
notion imagenotion image
๐Ÿ’ก
index.html ํŒŒ์ผ์„ ๊ฐ๊ฐ์— ํ•˜์œ„ ํด๋”๋กœ ๋„ฃ๊ณ  GitHub Page๋ฅผ ์šด์˜ํ•  ๊ฒฝ์šฐ ํ•˜์œ„ ํด๋”๋ฅผ http://{๊ณ„์ •๋ช…}.github.io/{ํด๋”๋ช…}/{ํด๋”๋ช…} ๊ณผ ๊ฐ™์ด URL ๊ตฌ์กฐ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ) paullabkorea/githubtest/test โ†’ ์‹ค์ œ๋กœ๋Š” test ํด๋”์— index.html๋กœ ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
์‹ค๋ฌด์—์„œ ๋ฐ”๋กœ ์ ์šฉํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ, github์„ ์ฒ˜์Œ ์‚ฌ์šฉํ•˜์‹œ๋Š” ๋ถ„์€ ๊ฐ€๋ณ๊ฒŒ GUI๋กœ๋งŒ ์‚ฌ์šฉํ•˜์‹œ๊ณ  ์ต์ˆ™ํ•ด์ง„ ๋‹ค์Œ CLI๋กœ ๋„˜์–ด๊ฐ€์‹œ๊ธธ ๊ถŒํ•ด๋“œ๋ฆฝ๋‹ˆ๋‹ค.

2. git clone

  • ์›๊ฒฉ ์ €์žฅ์†Œ์˜ ์ฝ”๋“œ๋ฅผ ์ปดํ“จํ„ฐ์— ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ ๋งŒ๋“ค๊ณ (mkdir ๋ช…๋ น์–ด) ์ƒ์„ฑํ•œ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™(cd ๋ช…๋ น์–ด)ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
    • $ mkdir filename $ cd filename $ git clone https://github.com/id/clone-filename.git .
      ย 
clone ํ•˜๊ธฐ ์ „clone ํ•˜๊ธฐ ์ „
clone ํ•˜๊ธฐ ์ „
clone ํ•œ ํ›„clone ํ•œ ํ›„
clone ํ•œ ํ›„
ย 
๐Ÿ’ก
ํด๋ก  ์‹œ ์ (.)์„ ์ฐ๋Š” ์ด์œ ๋Š” ํ˜„์žฌ ํด๋”์— ํด๋ก  ๋ฐ›๊ธฐ ์œ„ํ•ด์„œ ์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ, ์ (.)์„ ์ฐ์ง€ ์•Š์„ ๊ฒฝ์šฐ ์ƒˆ ํด๋”๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
ย 

3. git pull

์›๊ฒฉ ์ €์žฅ์†Œ์— ์—…๋ฐ์ดํŠธ ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ๋ณ‘ํ•ฉํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
$ git pull origin main
pull ํ•˜๊ธฐ ์ „pull ํ•˜๊ธฐ ์ „
pull ํ•˜๊ธฐ ์ „
pull ํ•œ ํ›„pull ํ•œ ํ›„
pull ํ•œ ํ›„
  • ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•˜๊ณ  pull ๋ฐ›์œผ๋ คํ•˜๋‹ˆ ๋ˆ„๊ตฐ๊ฐ€ ์ด๋ฏธ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ–ˆ์„ ๊ฒฝ์šฐ์— ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด ์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๋ถ„์ด push๋ฅผ ํ•˜๋ ค๊ณ  ํ–ˆ๋”๋‹ˆ ๋ˆ„๊ตฐ๊ฐ€ ์ด๋ฏธ push๋ฅผ ํ•ด์„œ pull์„ ๋ฐ›์•„์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด ๋œ๊ฑฐ์ฃ .
    • ์‹œ๋‚˜๋ฆฌ์˜ค A์‚ฌ๋žŒ clone --- push1 B์‚ฌ๋žŒ clone -------------- pull-push2 C์‚ฌ๋žŒ clone ------------------------------- push3(pull ๋ฐ›์ง€ ์•Š์•„ error)
      1. ๋กœ์ปฌ main๊ณผ ์›๊ฒฉ main์„ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜๋กœ ๋ณด๊ณ  ๋ณ‘ํ•ฉํ•ฉ๋‹ˆ๋‹ค.
        1. git pull --no-rebase
      1. ์‹œ๊ฐ„์ƒ ์ˆœ์„œ๋Œ€๋กœ ๋ณ‘ํ•ฉํ•ฉ๋‹ˆ๋‹ค.
        1. git pull --rebase

4. git add, git commit, git push

4.1 git add, git commit, git push

์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์€ ๊ณณ์— ์˜ฌ๋ฆฌ๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
  • ๊ถŒํ•œ์ด ์ฃผ์–ด์ง„ ๊ฒฝ์šฐ์—๋Š” ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ํ›„ ์ปค๋ฐ‹๊ณผ ํ‘ธ์‹œํ•˜๊ธฐ
    • $ git status $ git add . $ git commit -m "์ถ”๊ฐ€ ์ž‘์—… ๋‚ด์—ญ์ž…๋‹ˆ๋‹ค." $ git push origin main
ย 
push๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด GitHub์— ์ž˜ ์˜ฌ๋ผ๊ฐ”๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. push๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด ๋กœ์ปฌ ์ €์žฅ์†Œ์— ์žˆ๋Š” ์†Œ์Šค์ฝ”๋“œ ๋˜๋Š” ํŒŒ์ผ๋“ค์ด GitHub์— ์˜ฌ๋ผ๊ฐ€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
notion imagenotion image
notion imagenotion image
notion imagenotion image
ย 
GUI ํ™˜๊ฒฝ์—์„œ ํžˆ์Šคํ† ๋ฆฌ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์ฒ˜๋Ÿผ ๋ˆ„๊ฐ€ ์–ด๋–ค ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ–ˆ๋Š”์ง€ ๋‚ด์—ญ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜๋Œ๋ฆด ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
ย 
notion imagenotion image
ย 
  • ์›๊ฒฉ ์ €์žฅ์†Œ์™€ ๋กœ์ปฌ ์ €์žฅ์†Œ์˜ ์‹ฑํฌ๊ฐ€ ๋งž์ง€ ์•Š์•„(์˜ˆ๋ฅผ ๋“ค์–ด ์ปด๋ฐ‹ ๊ฐœ์ˆ˜๊ฐ€ ๋‹ค๋ฅด๋‹ค๋˜์ง€) ๋กœ์ปฌ ์ €์žฅ์†Œ๋กœ ๊ฐ•์ œ๋กœ ๋งž์ถ”๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ช…๋ น์–ด์ž…๋‹ˆ๋‹ค. ์ด ๋ช…๋ น์–ด๋Š” ํ˜ผ์ž ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ์‚ฌ์šฉํ•˜์‹œ๊ณ  ์ ˆ๋Œ€ ํ˜‘์—…์‹œ ์‚ฌ์šฉํ•ด์„œ๋Š” ์•ˆ๋˜๋Š” ๋ช…๋ น์–ด์ž…๋‹ˆ๋‹ค.
    • git push --force

4.2 git push password ์—๋Ÿฌ

  • (23๋…„ 3์›”, ๋งฅ๋ถ) token์„ ๋ฐœ๊ธ‰ํ•˜์ง€ ์•Š์•„๋„ readme.md ํŒŒ์ผ ์—†์ด ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์ƒ์„ฑ ํ›„ github์—์„œ ์ œ์‹œํ•œ ๋ช…๋ น์–ด๋ฅผ Visual Studio Code ํ„ฐ๋ฏธ๋„์— ์ž…๋ ฅํ•˜๋ฉด ๊ฐ„๋‹จํ•œ ์›น ์ธ์ฆ๋งŒ์œผ๋กœ ์—ฐ๊ฒฐ์ด ๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ  ๋ฐ”๋ž๋‹ˆ๋‹ค.(OS์— ๋”ฐ๋ผ ์•ˆ๋  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.)
push ํ•  ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋œฐ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 2021๋…„ 8์›” 13์ผ๋ถ€ํ„ฐ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฆ ์ง€์›์„ ์‚ฌ์šฉํ•˜์ง€ ๋ชปํ•˜๋„๋ก ๋ณด์•ˆ ์—…๋ฐ์ดํŠธ๊ฐ€ ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.
remote: support for password authentication was removed on august 13, 2021. please use a personal access token instead.
ย 
์œ„์™€ ๊ฐ™์€ ๊ฒฝ์šฐ, ๋น„๋ฐ€๋ฒˆํ˜ธ ๋Œ€์‹  token ์ด๋‚˜ ssh ๋‘๊ฐ€์ง€ ์ค‘ ํ•˜๋‚˜์˜ ์ธ์ฆ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์‹ค์Šต์€ 4.4.1 token ๋ฐœ๊ธ‰๋งŒ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

4.2.1. (์‹ค์Šต) token ๋ฐœ๊ธ‰ํ•˜๊ธฐ

  1. GitHub ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์— ์žˆ๋Š” ๊ฐœ์ธ ํ”„๋กœํ•„์„ ํด๋ฆญํ•œ ํ›„, Settings๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
notion imagenotion image
  1. ์ขŒ์ธก ๋ฉ”๋‰ด ๊ฐ€์žฅ ํ•˜๋‹จ์— ์žˆ๋Š” Developer settings > Personal access token > Personal access tokens (classic) > Generate new token์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
    1. notion imagenotion image
  1. ํด๋ฆญ์„ ํ–ˆ์„ ๋•Œ Generate new token (classic)์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”. ํœด๋Œ€ํฐ ์ธ์ฆ์„ ํ™œ์„ฑํ™” ๋‘์—ˆ๋‹ค๋ฉด ์•„๋ž˜์ฒ˜๋Ÿผ ํœด๋Œ€ํฐ ์ธ์ฆ์ด ๋–ด์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ํ™œ์„ฑํ™” ํ•ด๋‘์ง€ ์•Š์•˜๋‹ค๋ฉด ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๋Š” ์ฐฝ์ด ๋–ด์„๊ฒ๋‹ˆ๋‹ค.
    1. notion imagenotion image
      notion imagenotion image
  1. ์ธ์ฆ์„ ๋งˆ์น˜๋ฉด, ํ† ํฐ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ํ† ํฐ ์ด๋ฆ„๊ณผ ํ—ˆ๊ฐ€ํ•  ๊ถŒํ•œ์„ ์ฒดํฌํ•œ ํ›„์— Generate token์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. (repoํ•˜๋‚˜๋งŒ ์ฒดํฌํ•˜์…”๋„ ์‹ค์Šตํ•˜๋Š”๋ฐ ์ง€์žฅ ์—†์Šต๋‹ˆ๋‹ค.)
    1. notion imagenotion image
ย 
  1. ์ƒ์„ฑ๋œ ํ† ํฐ์„ ๋ณต์‚ฌํ•˜๊ณ  ํ•„์š”ํ•œ ๊ณณ์— ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด๋•Œ ํ† ํฐ์€ ํ•œ๋ฒˆ๋งŒ ๋ณด์—ฌ์ง€๊ธฐ ๋•Œ๋ฌธ์— ์•ˆ์ „ํ•œ ๊ณณ์— ๋ณด๊ด€ํ•ฉ๋‹ˆ๋‹ค. ์šฐ์„  ๋ฉ”๋ชจ์žฅ์— ๋ณต์‚ฌํ•ด๋‘์„ธ์š”. ๋ฐœ๊ธ‰๋œ ํ† ํฐ์€ ๋ถ€์—ฌ๋œ ๊ถŒํ•œ๋งŒ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์žฌ๋ฐœ๊ธ‰์„ ์›ํ•  ๊ฒฝ์šฐ์—๋Š” ์žฌ๋ฐœ๊ธ‰ํ•˜๊ณ ์ž ํ•˜๋Š” ํ† ํฐ์„ ํด๋ฆญ ํ›„, Regenerate token์„ ํด๋ฆญํ•˜๋ฉด ํ† ํฐ์ด ์žฌ์ƒ์„ฑ ๋ฉ๋‹ˆ๋‹ค.
    1. ย 
  1. ํ† ํฐ ๋ฐœ๊ธ‰์ด ์™„๋ฃŒ๋˜๋ฉด ์šด์˜์ฒด์ œ์— ๋งž๊ฒŒ ์ ์šฉ์‹œํ‚ต๋‹ˆ๋‹ค.
      • Windows
        • ์ œ์–ดํŒ > ์‚ฌ์šฉ์ž ๊ณ„์ • > ์ž๊ฒฉ ์ฆ๋ช… ๊ด€๋ฆฌ์ž > Windows ์ž๊ฒฉ์ฆ๋ช… > git:https//github.com ์ฐพ๊ธฐ > ํŽธ์ง‘ > ์•”ํ˜ธ๋ฅผ token์œผ๋กœ ๋Œ€์ฒด
      • Mac Mac OS์˜ ๊ฒฝ์šฐ push ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ์—ฌ์ „ํžˆ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋‚˜ํƒ€๋‚  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Mac ํ‚ค์ฒด์ธ์— ๋“ฑ๋ก๋˜์–ด ์žˆ๋Š” GitHub ๊ถŒํ•œ ์ •๋ณด๊ฐ€ ID/Password๋กœ ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ์š”. ์ด๋Ÿด ๊ฒฝ์šฐ์—๋Š” GitHub์˜ ๊ถŒํ•œ ์ •๋ณด๋ฅผ ์œ„์˜ ๋ฐœ๊ธ‰๋ฐ›์€ ID/Personal Access Token์œผ๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ์ˆœ์„œ์— ๋”ฐ๋ผ ๋ณ€๊ฒฝํ•ด๋ณด์„ธ์š”!
        • 1) ํ‚ค์ฒด์ธ ์ ‘๊ทผ (Keychain Access app)
          notion imagenotion image
          ย 
          2) github.com ์ฐพ๊ธฐ
          notion imagenotion image
      github.com์ด ์—†์œผ์‹  ๊ฒฝ์šฐ์—๋Š” ๋นจ๊ฐ„์ƒ‰ ๋ฐ•์Šค ๋ฒ„ํŠผ์„ ํด๋ฆญ ํ›„ ์ถ”๊ฐ€ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
      notion imagenotion image
      ย 
      ์•„๋ž˜์™€ ๊ฐ™์ด ์ด๋ฆ„๊ณผ ๊ณ„์ • ์ด๋ฆ„ ์ถ”๊ฐ€ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
      notion imagenotion image
      ย 
      3) ์•”ํ˜ธ๋ณด๊ธฐ(show password)๋ฅผ ํด๋ฆญํ•˜์—ฌ token ์•”ํ˜ธ๋กœ ๋Œ€์ฒดํ•ฉ๋‹ˆ๋‹ค.
      notion imagenotion image
      ย 
      4) ๋งŒ์•ฝ ์•„๋ž˜์™€ ๊ฐ™์€ ํ™”๋ฉด์ด ๋œจ๋ฉด MAC ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
      notion imagenotion image
ย 

4.2.2. SSH Key ์ƒ์„ฑํ•˜๊ธฐ

  1. ssh key๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. GitHub ๊ณ„์ • ์ƒ์„ฑ ์‹œ ์‚ฌ์šฉํ•œ ์ด๋ฉ”์ผ๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
    1. $ ssh-keygen -t rsa -C "email@example.com" Enter file in which to save the key (/c/Users/paullab/.ssh/id_rsa): Enter๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค. Enter passphrase (empty for no passphrase): github password Enter same passphrase again: github password
ย 
  1. ๊ณต๊ฐœํ‚ค๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ๊ณต๊ฐœํ‚ค๊ฐ€ ์ถœ๋ ฅ๋˜๋ฉด ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.
    1. $ cat ~/.ssh/id_rsa.pub
ย 
  1. GitHub ์ƒ๋‹จ์— ์žˆ๋Š” ๊ฐœ์ธ ํ”„๋กœํ•„์„ ํด๋ฆญํ•œ ํ›„, Settings๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
notion imagenotion image
ย 
  1. ์ขŒ์ธก ๋ฉ”๋‰ด์— SSH and GPG keys > New SSH key๋ฅผ ํด๋ฆญํ•˜์—ฌ SSH Key ์ด๋ฆ„๊ณผ Key์— ๋ณต์‚ฌํ•œ ๊ณต๊ฐœํ‚ค๋ฅผ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.
ย 
  1. SSH Key ๊ณต๊ฐœํ‚ค๊ฐ€ ์ž˜ ๋“ฑ๋ก๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
notion imagenotion image
ย 

  • ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๊ฐ€ ์ด๋ฏธ ์žˆ๋‹ค๋ฉด 2๋ฒˆ์งธ ์‚ฌํ•ญ ์„ ํƒ
    • notion imagenotion image
      git remote add origin https://github.com/paullabkorea/githubtest.git - https://github.com/paullabkorea/githubtest.git์ €์žฅ์†Œ๋ฅผ origin์ด๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ์—ฐ๊ฒฐ ๋“ฑ๋ก git branch -M main - ํ˜„์žฌ ๋กœ์ปฌ์—์„œ master๋กœ ๋˜์–ด ์žˆ๋Š” ๊ธฐ๋ณธ ๋ธŒ๋žœ์น˜๋ฅผ main์œผ๋กœ ์„ค์ • - ๊ธฐ๋ณธ ๋ธŒ๋žœ์น˜๋ช… ๋ณ€๊ฒฝ(git config --global init.defaultbranch main)์„ ํ•ด๋‘์…จ์œผ๋ฉด 2๋ฒˆ์งธ ์ƒ๋žต ๊ฐ€๋Šฅ git push -u origin main - origin์›๊ฒฉ ์ €์žฅ์†Œ์— main ๋ธŒ๋ Œ์น˜์— ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ์—ฐ๊ฒฐ(--set-upstream(๋‹จ์ถ• : -u) )
      ย