Development/Git
์ด๋ณด๋ค์ ์ํ ๊ฐ๋จํ Git ์ฌ์ฉ๋ฒ
Kirok Kim
2021. 12. 5. 23:33
1. Github์์ ์ ๋ก๋ ์ํฌ repo๋ฅผ ๋จผ์ ๋ง๋ ํ
2. ๋ก์ปฌ ์ปดํจํฐ์ ์ ๋ก๋ ์ํฌ ํ์ผ์ ์์ฑํ๋ค.
3. ํฐ๋ฏธ๋ ๋๋ iterm์ ์คํ์ํจ ์ดํ
4. ํด๋น ๋ช ๋ น์ด๋ฅผ ํตํด ํ์ฌ ์์น๋ฅผ ํ์ธ
pwdโ
5. ํด๋น ํ์ผ๋ก ์ด๋ํ ๋ค
cd ์
๋ก๋ ์ํฌ ํ์ผ๋ช
6. ํ๊ธฐ ๋ด์ฉ์ ์ฝ๋๋ฅผ ์์ฑํ๋ค.
echo "# repo ์ด๋ฆ" >> README.md
(์ด๊ฒ์ ์
๋ก๋ ์ํฌ ํ์ผ์ ์ค๋ช
๋ฌธ์ ์์ฑํ๋ ๊ฒ)
git init
(์
๋ก๋ ํ ๊ณณ์ ์ ํ๋ ๊ฒ)
git add README.md
(stage์ํจ๋ค)
git commit -m "์ปค๋ฐ ๋ฉํธ ์์ฑ"
(ํฐ ๋ฐ์ดํ ์์ ์ฒซ ์ปค๋ฐ ๋ฉํธ๋ฅผ ์์ฑํ๋ค)
git branch -M main
git remote add origin https://github.com/OOOOO/์
๋ก๋ํ repo.git
(origin ๋ค์ ๋์ค๋ ์ฃผ์๋ ์์ ์ด github์์ ๋ง๋ Repo์ ์ฃผ์์ด๋ค.)
git push -u origin main
(์
๋ก๋)
- ์์ ๋ด์ฉ์ github์์ repo๋ฅผ ๋ง๋ค๋ฉด ์๊ฐํ๋ git command line์ด๋ค.
ํน์ ์ฃผ์๋ฅผ ์๋ชป ์ ๋ ฅํ์๋ค๋ฉด ํ๊ธฐ ๋ด์ฉ์ ์ฐธ๊ณ ํ๋ฉด ๋๊ฒ ๋ค.
๋๋ณด๊ธฐ
git remote remove origin
git remote remove upstream
(ํ์๋ ์๋๋ค. ์๋ฃ๋์ง ์๋ ๊ฒฝ์ฐ ๋์ด๊ฐ๋ ๋ฌด๋ฐฉํ๋ค.)
git remote add origin https://github.com/OOOO/์
๋ก๋ํ repo.git
git remote -v
(์ด๊ฒ์ ํตํด repo์ฃผ์๋ฅผ ํ์ธํ ์ ์๋ค.)
๋ฐ์ํ