๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โœ’๏ธ GitHub & Git

[GitHub & Git] Git remote ๊ด€๋ จ ๋ช…๋ น์–ด ์ •๋ฆฌ

by A Lim Han 2023. 5. 30.

๐Ÿ‰ Git remote ๋ช…๋ น์–ด๋ž€?

 

Remote ๋ช…๋ น์–ด๋Š” Git(๋ถ„์‚ฐ ๋ฒ„์ „ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ)์ด ์›๊ฒฉ ์ €์žฅ์†Œ์™€์˜ ์ƒํ˜ธ ์ž‘์šฉ์„ ์œ„ํ•ด ์ œ๊ณตํ•˜๋Š” ๋ช…๋ น์–ด์˜ ์ผ์ข…์ด๋‹ค.
Remote ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์›๊ฒฉ ์ €์žฅ์†Œ๋ฅผ ์ œ๊ฑฐ, ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ˆ˜์ •ํ•˜๋Š” ๋“ฑ์˜ ์ž‘์—…์ด ๊ฐ€๋Šฅํ•˜๊ณ , ์›๊ฒฉ ์ €์žฅ์†Œ์™€์˜ ์—ฐ๊ฒฐ์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.

 


 

๐Ÿ‰ Git remote ๋ช…๋ น์–ด ์ •๋ฆฌ

1. ์ƒˆ๋กœ์šด ์›๊ฒฉ ์ €์žฅ์†Œ ์ถ”๊ฐ€

$ git remote add "์ €์žฅ์†Œ๋ช…" "์ €์žฅ์†Œ URL"

์ถ”๊ฐ€ํ•œ ์ €์žฅ์†Œ๋ช… ์ถ”๊ฐ€ํ•œ ์ €์žฅ์†Œ์˜ URL
RemoteTest https://github.com.alimhanhan/RemoteTest.git

 


 

2. ๊ธฐ์กด ์›๊ฒฉ ์ €์žฅ์†Œ ์ œ๊ฑฐ

$ git remote remove "์‚ญ์ œํ•˜๊ณ ์ž ํ•˜๋Š” ์ €์žฅ์†Œ๋ช…"

๊ธฐ์กด์— RemoteTest, newtesters ์ด 2๊ฐœ์˜ ์ €์žฅ์†Œ๊ฐ€ ์กด์žฌ

 

RemoteTest ๋ผ๋Š” ์ด๋ฆ„์˜ ์ €์žฅ์†Œ ์‚ญ์ œ
์„ฑ๊ณต์ ์œผ๋กœ ์‚ญ์ œ๋˜์—ˆ์Œ์„ ํ™•์ธ

 


 

3. ํ˜„์กดํ•˜๋Š” ์›๊ฒฉ ์ €์žฅ์†Œ ๋ชฉ๋ก ํ™•์ธ

$ git remote -v  # ํ˜„์กดํ•˜๋Š” ์ €์žฅ์†Œ๋ช…๊ณผ ๊ฐ URL์„ ํ•จ๊ป˜ ์ถœ๋ ฅ

$ git remote show  # ํ˜„์กดํ•˜๋Š” ์ €์žฅ์†Œ๋ช…๋งŒ ์ถœ๋ ฅ

git remote -v
git remote show

 


 

4. ์›๊ฒฉ ์ €์žฅ์†Œ๋ช… ๋ณ€๊ฒฝ

$ git remote rename "์ €์žฅ์†Œ์˜ ์ด์ „ ์ด๋ฆ„" "์ €์žฅ์†Œ์˜ ์ƒˆ ์ด๋ฆ„"

๊ธฐ์กด์˜ testers ์ €์žฅ์†Œ์˜ ์ด๋ฆ„์„ newtesters๋กœ ๋ณ€๊ฒฝ
์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€๊ฒฝ๋จ

 


 

5. ์›๊ฒฉ ์ €์žฅ์†Œ URL ๋ณ€๊ฒฝ

$ git remote set-url "์›๊ฒฉ ์ €์žฅ์†Œ๋ช…" "์ƒˆ๋กœ์šด URL"

newtesters ์ €์žฅ์†Œ์˜ ์›๋ž˜ URL์€ ์œ„์™€ ๊ฐ™์Œ
newtesters์˜ URL์„ Tester.git ์—์„œ changedTester.git์œผ๋กœ ๋ณ€๊ฒฝ
URL์ด ์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Œ์„ ํ™•์ธ

 


 

6. remote ๋ช…๋ น์–ด ์˜ต์…˜ ๋ฐ ์‚ฌ์šฉ๋ฒ• ํ™•์ธ

$ git remote --help

๋ช…๋ น์–ด ์‹คํ–‰ ์‹œ git-remote.html ํŽ˜์ด์ง€๋กœ ์—ฐ๊ฒฐ๋จ

 

git-remote.html ์˜ ๋‚ด์šฉ๋“ค