๐Ÿ”ถ [์˜ค๋ฆ„์บ ํ”„_1์ผ์ฐจ] Git, GitHub

์†์„ธ์€ยท2023๋…„ 11์›” 27์ผ
0

ํด๋” ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™(iterm)

๎‚ฐ cd desktop
๎‚ฐ cd dev
๎‚ฐ cd ORM_CAMP
๎‚ฐ cd dart-basic
  • open . ๋ช…๋ น์–ด๋ฅผ ๋‚ด๋ฆฌ๋ฉด ๋‚ด๊ฐ€ ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ์˜ ํด๋”๊ฐ€ ๋ฐ”๋กœ ์ผœ์ง„๋‹ค

์ดˆ๊ธฐ ์„ค์ •

	echo "# dart-basic" >> README.md //README.md ์ƒ์„ฑํ•˜๋Š” ๋ฆฌ๋ˆ…์Šค ๋ช…๋ น์–ด
  git init                         //๊นƒ ์ดˆ๊ธฐํ™”, ๊ธฐ๋ณธ์ ์œผ๋กœ ํ•˜๋‚˜์˜ ๋ธŒ๋žœ์น˜๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค                    
  git add README.md  //์ด ํด๋” ์•ˆ์˜ README.md ํŒŒ์ผ์„ ๊ด€๋ฆฌํ•˜๊ฒ ๋‹ค.(์ธ๋ฑ์‹ฑํ•œ๋‹ค. ํŠธ๋ž™ํ•œ๋‹ค.) 
  git commit -m "first commit" //๋‚ด๊ฐ€ ์ˆ˜์ •ํ•œ๊ฑฐ ์ €์žฅํ•˜๊ฒ ๋‹ค. ์„œ๋ฒ„์— ์˜ฌ๋ฆฌ๊ธฐ ์ „์— ๋กœ์ปฌ์ €์žฅ์†Œ์— save
  git branch -M main   //๋ธŒ๋žœ์น˜ ์ด๋ฆ„์„ main์œผ๋กœ ๋ณ€๊ฒฝ
  git remote add origin https://github.com/seeunson/dart-basic.git
  // ๋กœ์ปฌ ์ €์žฅ์†Œ๋ฅผ origin์ด๋ผ๋Š” ๋ณ„์นญ์œผ๋กœ ์›๊ฒฉ ์ €์žฅ์†Œ๋ฅผ์— ์—ฐ๊ฒฐ
  git push -u origin main
  //๋กœ์ปฌ ์ €์žฅ์†Œ origin์„ ์›๊ฒฉ ์ €์žฅ์†Œ main ๋ธŒ๋žœ์น˜์— ์—…๋กœ๋“œ
  • public์˜ ๊ฒฝ์šฐ
git remote add origin https://github.com/seeunson/dart-basic.git
  • private์˜ ๊ฒฝ์šฐ
git remote add origin https://seeunson.com/seeunson/dart-basic.git

๊นƒ ์ดˆ๊ธฐ ์„ค์ • ํ›„ ๋ฐ˜๋ณต

git add .
git commit -m "์ˆ˜์ •์‚ฌํ•ญ"
git push  

Q. ์„œ๋ฒ„์— ์˜ฌ๋ฆฌ๊ธฐ ์ „์ด๋ผ๋ฉด ๋กœ์ปฌ ์ €์žฅ์†Œ์— ์ €์žฅํ•˜๋Š” ๊ฑด๊ฐ€์š”?

  • ๊ทธ๋ ‡๋‹ค๊ณ  ํ•œ๋‹ค. push๋กœ ์›๊ฒฉ ์ €์žฅ์†Œ์— ์—…๋กœ๋“œ!

์ด์™ธ ๋“ฑ๋“ฑ

  • ๊ธ€๋กœ๋ฒŒ ์„ค์ • ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•
git config user.name
git config user.email
  • ํ˜„์žฌ ์—ฐ๊ฒฐ๋œ ์›๊ฒฉ ์ €์žฅ์†Œ ํ™•์ธ ๋ฐฉ๋ฒ•
git remote -v
origin	https://github.com/seeunson/dart-basic.git (fetch)
origin	https://github.com/seeunson/dart-basic.git (push)
  • git branch ํ™•์ธ ํ›„ ๋ชป๋‚˜์˜ฌ ๊ฒƒ ๊ฐ™์„ ๋•Œ q

error: 403

git push -u origin main     
remote: Permission to seeunson/dart-basic.git denied to WKDev.
fatal: unable to access 'https://github.com/seeunson/dart-basic.git/': The requested URL returned error: 403
  • ๋ฐœ์ƒ ์›์ธ : Git CLI์˜ ๊ณ„์ •๊ณผ Github์˜ ๊ณ„์ •์ด ๋‹ฌ๋ผ์„œ ์ƒ๊ธด 403 ์—๋Ÿฌ!
  • ๋‚ด๊ฐ€ ํ•œ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•:
git remote add origin https://seeunson.com/seeunson/dart-basic.git
git push origin main
profile
ํž™์Šคํ„ฐ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋ ๋ž˜์š”

0๊ฐœ์˜ ๋Œ“๊ธ€