๋๋ฌด ๋น์ฐํ๊ฒ ์ฌ์ฉํ๋ ๋ด์ฉ์ด์ง๋ง, ๊น๋จน์ง ์๊ธฐ ์ํด + ๊ธฐ์ด๋ฅผ ๋ค์ ๋์ง๊ธฐ ์ํด ๋จ๊ฒจ๋ณด๋ ๊ธ
Github
๊นํ๋ธ๋ ์ํํธ์จ์ด ๊ฐ๋ฐ์ ์ฝ๋๋ฅผ ๊ด๋ฆฌํ๊ณ ๊ธฐ๋กํ์ฌ ์ฒด๊ณ์ ์ธ ๊ฐ๋ฐ์ด ๊ฐ๋ฅํ๋๋ก ๋์์ฃผ๋ ๊ณต๊ฐ ์ํํธ์จ์ด.
- git for windows ์ค์น : https://gitforwindows.org/
Git for Windows
Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git BASH Git for Windows provides a BA
gitforwindows.org
๊น์ ์ปค๋ฐ, ํธ์, ํ์ ํ๊ธฐ ์ํด์๋ ๋จผ์ ๊นํ๋ธ ๊ณ์ ์ด ์กด์ฌํด์ผ ํ๊ณ ๋ ํฌ์งํ ๋ฆฌ๋ฅผ ํ๋ ์์ฑํด ๋์ด์ผ ํ๋ค.
Repository name์ ์ฌ์ฉํ๊ณ ์ถ์ ๋ ํฌ ์ด๋ฆ์ ์ ๋ ฅํ ํ Create repository ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์์ฑ ์๋ฃ.
์ ์ฅ์ ๊ฒฝ๋ก๋ ๋ค์๊ณผ ๊ฐ์ ์์น์์ ํ์ธํ ์ ์๋ค.
์ด์ git bash ๋๋ vscode๋ฅผ ์ด์ฉํ์ฌ ๋ก์ปฌ ์์น๋ฅผ ์ค์ ํ๊ณ , ๊น์ ํ์ผ์ ์ฌ๋ฆด ์ ์์!
- vscode ์คํ ํ Ctrl+` ํ ๊ธํ์ฌ ํฐ๋ฏธ๋ ์ด๊ธฐ → ์ฐ์ธก ํ๋จ์์ ํฐ๋ฏธ๋ ์ค์ ์ Git Bash๋ก ๋ณ๊ฒฝ
1. ํ์ฌ ํด๋๋ฅผ git ์ ์ฅ์๋ก ์ค์ (๊น์ ์ฌ๋ฆฌ๊ณ ์ ํ๋ ๋ก์ปฌ ์์น๋ก ์ด๋ํ ๋ค ๋ช ๋ น์ด ์ ๋ ฅ)
git init
2. ์ ์ ์ด๋ฆ๊ณผ ๋ฉ์ผ ์ฃผ์ ์ค์ → ๊น ์ฒ์ ์ฌ์ฉ์์๋ง ๋ฑ๋กํด์ฃผ๋ฉด ๋จ
git config --global user.name "์ ์ ์ด๋ฆ"
git config --global user.email "์ ์ ์ด๋ฉ์ผ"
3. ๋ ํฌ์งํ ๋ฆฌ ์ถ๊ฐ ๋๋ ์ ๊ฑฐ
git remote add origin https://github.com/<user-name>/<repository-name>.git
git remote remove origin
# ํ์ฌ ํ๋ก์ ํธ์ ๋ฑ๋ก๋ ๋ฆฌ๋ชจํธ ์ ์ฅ์ ํ์ธ
# ์ ์ฅ์ clone์ origin ๋ฆฌ๋ชจํธ ์ ์ฅ์๊ฐ ์๋์ผ๋ก ๋ฑ๋ก๋จ
git remote
# ์๊ฒฉ ์ ์ฅ์ ๊ฒฝ๋ก ํ์ธ
git remote -v
4. ํ์ผ์ ์๊ฒฉ ์ ์ฅ์์ ์ถ๊ฐ (๊น ์ ์ฅ์์ ์ค๋ ์ท์ ์ถ๊ฐ)
# . ์
๋ ฅ์ ํด๋ ์์ ๋ชจ๋ ๋ณ๊ฒฝ๋ ํ์ผ์ด ํฌํจ๋จ
# ํ์ผ๋ช
์
๋ ฅ์ ์ํ๋ ํ์ผ๋ง addํ ์ ์์
git add .
# ํ์ผ ์ถ๊ฐ๋์๋์ง ํ์ธ (๋นจ๊ฐ์: ํ์ผ์ด ๋ณ๊ฒฝ๋์์ผ๋ ์ถ๊ฐ๋์ง ์์, ์ด๋ก์: ์ถ๊ฐ๋ ํ์ผ)
git status
5. ์ปค๋ฐ (ํ์ผ์ด๋ ํด๋์ ์ถ๊ฐ ๋๋ ๋ณ๊ฒฝ์ ์ ์ฅ์์ ๊ธฐ๋ก)
git commit -m "์ปค๋ฐ ๋ฉ์์ง"
# ์ค์นํ๊ณ ์ฒ์ ํ ๋ฒ์ ๊ธฐ๋ณธ ๋ธ๋์น๋ฅผ main์ผ๋ก ์ค์ ํด ์ฃผ์ด์ผ ํจ
git branch -M main
# ์ปค๋ฐ ๋ฉ์์ง ๋ณ๊ฒฝ
git commit -m "์ปค๋ฐ ๋ฉ์์ง" --amend
6. ํธ์ (๋ก์ปฌ ์ ์ฅ์์ ์๋ ํ์ผ์ ์๊ฒฉ ์ ์ฅ์์ ๋ฐ์)
git push origin main
์ดํ ์์ ๋ ํ์ผ์ ๊นํ๋ธ์ ํธ์ํ๊ธฐ๋ฅผ ์ํ๋ฉด, ์ ๊ณผ์ ์ ์๋ตํ๊ณ ์๋์ ๊ฐ์ด ์ ๋ ฅํ๋ฉด ๋๋ค.
git add .
git commit -m "๋ฉ์์ง"
git push origin main
'๐ฌ CI ยท CD > Git : ๊น' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Git] Sourcetree ์ฌ์ฉ๋ฒ (์ค์น, Clone) (0) | 2025.03.12 |
---|---|
[Git] cmd command๋ก git ์ด์ฉํ๊ธฐ (0) | 2025.02.05 |
[GitLab] CentOS 7์ GitLab (ce) ์ค์นํ๊ธฐ - ์คํ๋ผ์ธ(์๋) ์ค์น (0) | 2023.04.11 |
[GitLab] CentOS 7์ GitLab (ce) ์ค์นํ๊ธฐ - curl/yum ์ด์ฉํ ์จ๋ผ์ธ ์ค์น (0) | 2023.04.10 |
[GitLab] Linux CentOS 8 ํ๊ฒฝ GitLab ์ค์น ๋ฐ ๊ธฐ๋ (0) | 2023.02.10 |