Β
μ μΈκ³μ μΌλ‘ κ°μ₯ λ§μ΄ μ°μ΄κ³ μλ λ²μ κ΄λ¦¬ νλ‘κ·Έλ¨μΈ GitHubμ μ¬μ©νλ λ°©λ²μ λν΄μ λ¨Όμ 보μ¬λλ¦¬κ³ , GitHubμ μ μ¬μ©ν΄μΌ νλμ§ κ°λ΅νκ² μ€λͺ
νκ² μ΅λλ€.
Β
1. GitHub μ μ₯μ μμ±
GitHubμ λ‘κ·ΈμΈ νκ³ λμ μ€λ₯Έμͺ½ μλ¨μ 보μλ©΄ + λ²νΌμ΄ μμ΅λλ€. μ΄ λ²νΌμ ν΄λ¦νμκ³ 'New Repository'λ₯Ό ν΄λ¦ν©λλ€.


Repository name(μ μ₯μ μ΄λ¦)μ μ
λ ₯ν΄μ€λλ€. Descriptionμ κ°λ¨ν μ€λͺ
μ μ
λ ₯νμ
λ μ’μ΅λλ€. μ νμ¬ν(optional)μ
λλ€.
κ·Έλ¦¬κ³ Public μ μ₯μκ° μλλΌ Private μ μ₯μλ₯Ό μμ±νκ² μ΅λλ€. Create Repository λ²νΌμ λλ₯΄λλ‘ νκ² μ΅λλ€.

Β
GitHub Repositoryλ₯Ό μμ±νκ² λλ©΄ 첫 λ²μ§Έ νμ΄μ§μ ν°λ―Έλμ ν΅ν΄ μ΄λ»κ² Gitμ μΈν
ν΄μΌνλμ§ μμ±λμ΄ μμ΅λλ€. μ΄ λͺ
λ Ήμ΄λ€μ ν°λ―Έλμ μ
λ ₯νμλ©΄ λ©λλ€.

Β
2. νλ‘μ νΈμ Git μ€μ
μ°μ κ΅¬λ¦ IDEμ μ μν©λλ€. μμ±λ 컨ν
μ΄λκ° μλ κ²μ νμΈν μ μμ΅λλ€.

Β
μ€ν λ²νΌμ λλ¬μ λ°λ‘ μ¬μ€ μλ μμ§λ§ GitHubμ ν°λ―Έλμμ λλΆλΆμ μμ
μ μ§νν μ μκΈ° λλ¬Έμ 컨ν
μ΄λλ₯Ό ν°λ―Έλλ‘ μ€νμ ν΄λ³΄λλ‘ νκ² μ΅λλ€.
Β
ν°λ―Έλμ΄ μ€νμν€κ³ ls λͺ
λ Ήμ΄λ₯Ό μ
λ ₯ν©λλ€.
root@goorm:/workspace/instaclone# ls
Β

Β
instaclone
ν΄λκ° λ³΄μ΄κ² λ©λλ€. instaclone
ν΄λ μμΌλ‘ λ€μ΄κ°λλ‘ νκ² μ΅λλ€.root@goorm:/workspace/instaclone# cd instaclone/
Β

Β
instaclone
μλμ μλ νμΌλ€μ λ³νλ₯Ό μΆμ νκΈ° μν΄ λ²μ κ΄λ¦¬ μ§ννλλ‘ νκ² μ΅λλ€. μ°μ , μ΄λ€ νμΌμ΄ μλμ§ νμΈν©λλ€.root@goorm:/workspace/instaclone/instaclone# ls
Β

Β
venv
ν΄λλ μΆμ νμ§ μμ κ²λλ€. λ€λ₯Έ κ³³μμ μμ
μ ν λλ κ°μ νκ²½μ μλ‘ λ§λ€ κ²μ΄κΈ° λλ¬Έμ
λλ€.Β
Gitμ μ¬μ©νκΈ° μμ, λ¨Όμ μ΄κΈ°νλ₯Ό μν€κ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git init
Β

Β
ν΄λμ μ΄λ€ λ³νκ° μλμ§ νμΈνκ² μ΅λλ€. ls λͺ
λ Ήμ΄λ₯Ό μ
λ ₯νμλ©΄ λ³νκ° μλ κ²μ νμΈν μ μμ΅λλ€.
git initμ μννλ©΄
.git
ν΄λκ° μμ±λλλ° μ΄ νμΌμ μ¨κΉνμΌμ΄λΌ κΈ°λ³Έμ μΈ ls λͺ
λ Ήμ΄λ‘ νμΈ ν μ μμ΅λλ€. λμ , -a λλ -al μΆκ° μ΅μ
μ μ£Όλ©΄ μ¨κΉνμΌμ νμΈν μ μμ΅λλ€.root@goorm:/workspace/instaclone/instaclone# ls - a root@goorm:/workspace/instaclone/instaclone# ls -al
Β

Β
.git
μ΄λΌλ ν΄λκ° μλ‘ μκΈ΄ κ²μ λ³Ό μ μμ΅λλ€. μ΄ μμ μλ νμΌλ€μ΄ μ΄ ν΄λ μμ λ³νλ€μ μΆμ ν κ² λ κ²μ
λλ€.Β
3. Git μ¬μ©νκΈ°
Gitμ΄ μ΄λ€ νμΌλ€μ μΆμ νκ² λ μ§ λͺ
ννκ² μλ €μ€μΌ ν©λλ€.
root@goorm:/workspace/instaclone/instaclone# git status
Β

Β
'Untracted files' λΌκ³ μμ΅λλ€. λΉ¨κ°μμΌλ‘ νμλ κ²μ μμ§ μΆκ°κ° μ λ νμΌκ³Ό ν΄λμ
λλ€.
κ΄λ¦¬ν νμΌμ΄λ ν΄λλ₯Ό μΆκ°ν ν git status κ° μ΄λ»κ² λ³νλμ§ λ³΄κ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git add config/ root@goorm:/workspace/instaclone/instaclone# git status
Β

Β
config
ν΄λ μλμ μλ νμΌλ€μ΄ new file μ΄λΌκ³ λ
ΉμμΌλ‘ νμλλ κ²μ λ³Ό μ μμ΅λλ€.κ·Έλ¬λ©΄ Gitμ΄ new fileμ ν΄λΉνλ νμΌλ€μ λ³νλ₯Ό μΆμ νκ² λλ κ²μ
λλ€.
Β
λ€λ₯Έ κ²λ€λ μΆκ°ν΄λ³΄λλ‘ νκ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git add manage.py root@goorm:/workspace/instaclone/instaclone# git add db.sqlite3 root@goorm:/workspace/instaclone/instaclone# git status
Β

Β
μ΄μ μνλ νμΌλ€μ λ³νλ₯Ό μΆμ ν μ μμ΅λλ€.
μ΄λ¬ν λ³κ²½μ¬νλ€μ commit ν΄μΌ ν©λλ€. νμΌμλ€κ° μ΄λ€ κ²μ μμ νλμ§ κ°λ¨ν λ©λͺ¨λ₯Ό λ¨κΈ°λ κ²μ
λλ€.
root@goorm:/workspace/instaclone/instaclone# git commit -m "first commit"
Β

νμ§λ§ μ²μμλ commitμ΄ λμ§ μκ³ μ¬μ§κ³Ό κ°μ΄ git μ¬μ©μλ₯Ό μ€μ νλΌλ λ©μμ§κ° μΆλ ₯λ©λλ€. commitμ κ²½μ° μ΄λ€ κ°λ°μκ° commitμ νλμ§κ° κΈ°λ‘λμ΄μΌ νκΈ° λλ¬Έμ git μ¬μ©μλ₯Ό λ°λμ μ€μ ν΄μ£Όμ΄μΌ ν©λλ€.
Β
gitμ emailκ³Ό nameμ μ€μ νλλ‘ νκ² μ΅λλ€. λ³ΈμΈμ κ°μ κΉνλΈ μ΄λ©μΌκ³Ό μ μ λ€μμ μ μΌμλ©΄ λ©λλ€.
root@goorm:/workspace/instaclone/instaclone# git config --global user.email asdasd@naver.com root@goorm:/workspace/instaclone/instaclone# git config --global user.name name
Β
λ€μ λͺ
λ Ήμ΄λ₯Ό ν΅ν΄ μ€μ μ νμΈν μ μμ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git config --list
Β

Β
λ€μ commitμ μλνλ©΄ λ©λλ€. μ΄λ λ€μ νμ΄ννμ€ νμλ μμ΅λλ€. μλνλ©΄, ν°λ―Έλ μ°½μμ νμ΄ν λ°©ν₯ν€ β λ₯Ό μ
λ ₯νλ©΄ μμ μ μ
λ ₯νλ λͺ
λ Ήμ΄λ₯Ό μλμΌλ‘ μμ±ν΄μ€λλ€.
root@goorm:/workspace/instaclone/instaclone# git commit -m "first commit"
Β

Β
μ΄μ commitμ΄ μ λ κ²μ λ³Ό μ μμ΅λλ€. κ·Έλ¬λ©΄ μ¨λΌμΈμ μλ μμ μ GitHub 곡κ°κ³Ό μ°κ²°μν¬ κ²μ
λλ€.
root@goorm:/workspace/instaclone/instaclone# git remote add origin https://github.com/"μμ μ μ μ₯μ μ£Όμλ₯Ό μ°Έκ³ "
Β
μ΄λ€ μ£Όμλ₯Ό λ£μ΄μΌ ν μ§ λͺ¨λ₯΄κ² λ λΆμ μ²μ GitHub Repository μμ± μμ λ΄€λ νμ΄μ§μ κ·Έλλ‘ λμ μμΌλ μ°Έκ³ νλ©΄ μ’μ κ² κ°μ΅λλ€. μ΄λ, μμ μ μ£Όμλ₯Ό μ
λ ₯ν΄μΌ ν©λλ€.

Β

Β
κ΅¬λ¦ IDEμ ν°λ―Έλμμλ λ³΅μ¬ λλ λΆμ¬λ£κΈ° λ¨μΆν€κ° λ€λ₯΄λ€λ κ² μ°Έκ³ νμκΈΈ λ°λλλ€. Shift ν€λ§ μΆκ°μ μΌλ‘ λλ₯΄μλ©΄ λ©λλ€.
λ³΅μ¬ : Ctrl + Shift + C
λΆμ¬λ£κΈ° : Ctrl + Shift + V
Β
μμ
νκ³ commitν λ΄μ©λ€μ μ μ₯μμ μ
λ‘λνλλ‘ νκ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git push -u origin master
Β
μμ μ GitHub Usernameκ³Ό λΉλ°λ²νΈλ₯Ό μ
λ ₯ν΄μ€λλ€.

Β
μ±κ³΅μ μΌλ‘ pushκ° λ κ²μ λ³Ό μ μμ΅λλ€.

Β
μ μ
λ‘λ λμλμ§ νμΈνκΈ° μν΄ GitHub Repositoryλ₯Ό μ΄ν΄λ³΄κ² μ΅λλ€. GitHub νμ΄μ§λ₯Ό μλ‘κ³ μΉ¨νλ©΄ pushν κ²μ νμΈν μ μμ΅λλ€.

Β
commit λ²νΌμ λλ¬λ³΄κ² μ΅λλ€.

Β

Β
commit λ©μμ§ "first commit"μ΄ λ³΄μ
λλ€. μ΄λ° λ°©μμΌλ‘ commitλ€μ΄ μμ΄λ κ²μ
λλ€.

Β
commitμ νμ©νλ©΄ λ¬Έμ κ° μκ²Όμ λ, λ¬Έμ κ° μμλ μμΉλ‘ λλ릴 μ μμ΅λλ€.
μ¬λ¬λΆμ΄ λ§μ§λ§μΌλ‘ commit νμ λλ μ€λ₯κ° μμλλ° μμ
νκ³ λ³΄λ μ€λ₯κ° μκ²ΌμΌλ©΄ λ§μ§λ§ commit λ΄μ©μΌλ‘ λλ릴 μ μμ΅λλ€.
Β
κ΅¬λ¦ IDEλ‘ κ°μ, μκΉ μ€λ₯κ° λ¬λ λΆλΆ '*' λ₯Ό μ§μμ λ€μ μ€λ₯κ° λλλ‘ λ°κΏλ³΄κ² μ΅λλ€.


Β
μ μ₯νμ λ€μ μλ²λ₯Ό μΌκ³ URLμ ν΅ν΄ μ μνλ©΄ λ€μ μλ¬κ° λνλ©λλ€.
(venv)root@goorm:/workspace/instaclone/instaclone# python manage.py runserver 0:80
Β


Β
νμ¬ μν©μμ κΈλ°© ν΄κ²°ν μ μλ μλ¬μ΄μ§λ§ λ§μ μμ μ½λμ νμΌμ μμ ν μν©μμλ μλ¬λ₯Ό μμ νκΈ° μ΄λ ΅μ΅λλ€. μ΄λ, κ°λ¨νκ² λͺ¨λ λ³κ²½ μ¬νμ μ΄κΈ°νμν€λ κ²μΌλ‘ μ²μλΆν° λ€μ μμν μ μμ΅λλ€.

Β
μ μ¬μ§μ²λΌ ν°λ―Έλμμ μλ²κ° μλλκ³ μλ€λ©΄ ν°λ―Έλμμ Ctrl + c λλ¬μ μλ²λ₯Ό λλλ€. κ·Έλ¬λ©΄ λ€μ ν°λ―Έλμ΄ λͺ
λ Ήμ΄λ₯Ό λ°λ μνλ‘ λμμ΅λλ€.
Β
μ΄μ λ€μ λͺ
λ Ήμ΄λ‘ commitμ λλλ €λ΄
μλ€.
root@goorm:/workspace/instaclone/instaclone# git reset --hard
Β

Β
'*'κ° λμμμ΅λλ€. "first commit" νλ μνλ‘ λ³ν κ²μ μ μ μμ΅λλ€.
Β
μ΄λ κ² μμ μ νμΌμ μ΄μ λ²μ μΌλ‘ 볡ꡬν μ μμ΅λλ€. μ¬λ¬λΆλ€λ κ³Όμ μ λ°λΌνμλ€κ° λ¬Έμ κ° μκΈ°κ³ λ κ·Έ λ¬Έμ λ₯Ό ν΄κ²°νμ§ λͺ»νμκ² λ€λ©΄ μ΄λ¬ν λ°©λ²μΌλ‘ λλλ €μ λ€μ μμν μ μμ΅λλ€.
Β