DevOps/Git

commit ํ•œ ๊ฒƒ์„ push ํ–ˆ๋Š”๋ฐ ์ž˜๋ชป ์˜ฌ๋ฆฌ๊ฒŒ ๋˜์–ด ๊ทธ commit์„ ํ”์ ๋„ ์—†์ด ์ง€์šฐ๊ณ  ์‹ถ๋‹ค๋ฉด git revert ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. git log ๋ฅผ ํ†ตํ•ด์„œ commit ์ด๋ ฅ์„ ํ™•์ธํ•œ ๋’ค, ์ด๋™ํ•˜๊ณ  ์‹ถ์€ commit์˜ id ๋ฅผ ์ฐพ๋Š”๋‹ค. git reset [commit id] ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์›ํ•˜๋Š” commit ์œผ๋กœ ์ด๋™ ํ›„ git push origin main ํ•˜๋ฉด ๋!! ์ด๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์—๋Ÿฌ๊ฐ€ ๋‚œ๋‹ค๋ฉด? git push origin +main ํ•˜๋ฉด ๋ [์ถœ์ฒ˜] https://velog.io/@rkio/Git-push-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
Your local changes to the following files would be overwritten by merge, Please commit your changes or stash them before you merge UMC ํ™œ๋™ ์ค‘์—์„œ ์›๊ฒฉ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ์žˆ๋Š” ํŒŒ์ผ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ฌ ๋•Œ, ์ด์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค. ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ์ง€๋งŒ. ๋‚˜๋Š” ์ด์™€ ๊ฐ™์€ ๋ช…๋ น์–ด๋กœ ์œ„ ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ–ˆ๋‹ค. $ git stash ํŒŒ์ผ๋“ค ์ž„์‹œ์ €์žฅํ•œ ํ›„, ๋‹ค์‹œ git merge ์‹คํ–‰ํ•˜๋ฉด ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค.
UMC์—์„œ ๐Ÿ’ป์•ฑ ๋Ÿฐ์นญ ํ”„๋กœ์ ํŠธ๐Ÿ’ป๋ฅผ ํ•œ์ฐฝ ์ง„ํ–‰ ์ค‘์ธ๋ฐ Git์„ ์ฒ˜์Œ์จ๋ด์„œ ์–ด๋ ค์›€์„ ๊ฒช๊ณ  ์žˆ๋Š” ์š”์ฆ˜์ด๋‹ค. ๐Ÿ˜ข ํŠนํžˆ, ์›๊ฒฉ ์ €์žฅ์†Œ์— pull request ํ›„ merge ๋œ ํŒŒ์ผ์„ ๋‹ค์‹œ ๋‚ด ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ถˆ๋Ÿฌ์˜ค๋ ค๋‹ค๊ฐ€ ์ง€๋‚œ๋ฒˆ ์—๋Ÿฌ๊ฐ€ ๋‚˜๊ณ  ๋‹ค์‹œ ์ฒ˜์Œ fork ๋ถ€ํ„ฐ ์ง„ํ–‰ํ–ˆ๋˜ ๋ถˆ์ƒ์‚ฌ๊ฐ€ ์žˆ์—ˆ๋‹ค. 1. git remote git remote -v ๋ฅผ ํ†ตํ•ด ์›๊ฒฉ ์ €์žฅ์†Œ๊ฐ€ ์ €์žฅ ๋˜์–ด ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•œ ์‚ฌ๋žŒ์€ ์ด ๊ณผ์ •์„ ๊ฑด๋„ˆ ๋›ฐ์–ด๋„ ๋œ๋‹ค. upstream ์˜ ๊ฒฝ์šฐ์—๋Š” ์ž์‹ ์ด ์›ํ•˜๋Š” ์ด๋ฆ„์œผ๋กœ ์ €์žฅ ๊ฐ€๋Šฅํ•˜๋‹ค. ํ•„์ˆ˜์ ์ธ ์ด๋ฆ„์ด ์•„๋‹ˆ๋‹ค. $ git remote add upstream [git clone ์ฃผ์†Œ] $ git remote -v 2. git fetch $ git fetch upstream main //upstream : ์ž..
๐Ÿ–ŠGitHub์— ๋ณ€๊ฒฝํ•œ ํŒŒ์ผ์„ ์—…๋กœ๋“œ ํ•˜๋Š” ๋ฐฉ๋ฒ• git add . git commit -m "์›ํ•˜๋Š” ๋‚ด์šฉ commit" git push origin [branch ๋‚ด์šฉ] ๋…ผ์™ธ๋กœ, GitHub์— ์ฒซ ํŒŒ์ผ ์—…๋กœ๋“œํ•˜๋Š” ๊ฒƒ์€ GitHub ํŒŒ์ผ ์ƒ์„ฑ์‹œ, ์ฒซ ํ™”๋ฉด ๋”ฐ๋ผํ•˜๋ฉด ๋‚˜์˜จ๋‹ค.
๊ฐ์ฒด์ง€ํ–ฅ์ ์–ธ์–ด์™€ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์ˆ˜์—…์œผ๋กœ backend frontend ํŒŒ์ผ์„ ์˜ฌ๋ฆฌ๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ๊ฐ‘์ž๊ธฐ ์ด์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€,,,,, error: failed to push some refs to 'https://github.com/~~~/***.git' [ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•] branch๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ์ด๊ธฐ ๋•Œ๋ฌธ์— 'branch๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. -> ๋‚˜๋Š” ์ด๋žฌ๋Š”๋ฐ, ์›๊ฒฉ์ €์žฅ์†Œ๋ž‘ ๋กœ์ปฌ์ €์žฅ์†Œ๊ฐ€ ๋‹ค๋ฅธ ๊ฒฝ์šฐ์—๋„ ๊ทธ๋Ÿด ์ˆ˜๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•จ. ( git pull -> git push ํ•˜๋ฉด ํ•ด๊ฒฐ ์™„๋ฃŒ) //1๋ฒˆ $ git branch -m main //2๋ฒˆ $ git push -u origin main git ํŒŒ์ผ ์ถ”๊ฐ€ ์™„๋ฃŒ!! [์ถœ์ฒ˜] https://iancoding.tistory.com/240
GitHub์— "์ ˆ์ฐจ์ ์‚ฌ๊ณ ์™€ ํ”„๋กœ๊ทธ๋ž˜๋ฐ" ์ˆ˜๊ฐ•์‹ ์ฒญ ํ”„๋กœ๊ทธ๋žจ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ํŒŒ์ผ์„ GitHub์— ์—ฐ๋™ํ•˜๋ ค๊ณ ํ•˜๋Š”๋ฐ ์ด์™€ ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค. 1. git@github.com: permission denied (publickey). fatal: could not read from remote repository 2. //git remote add origin https://github.com/**/**.git ๋ช…๋ น์–ด ์‚ฌ์šฉ์‹œ fatal: remote origin already exists. ์ด์™€ ๊ฐ™์€ ๋ฌธ์ œ์— ๋Œ€ํ•œ ํ•ด๊ฒฐ์ฑ…์„ ์ ๊ณ ์žํ•œ๋‹ค. 1. git@github.com: permission denied (publickey). fatal: could not read from remote repository CMD ..
chaerlo127
'DevOps/Git' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก