Β
μ μΈκ³μ μΌλ‘ κ°μ₯ λ§μ΄ μ°μ΄κ³ μλ λ²μ κ΄λ¦¬ νλ‘κ·Έλ¨μΈ GitHubμ μ¬μ©νλ λ°©λ²μ λν΄μ λ¨Όμ 보μ¬λλ¦¬κ³ , GitHubμ μ μ¬μ©ν΄μΌ νλμ§ κ°λ΅νκ² μ€λͺ
νκ² μ΅λλ€.
Β
1. GitHub μ μ₯μ μμ±
GitHubμ λ‘κ·ΈμΈ νκ³ λμ μ€λ₯Έμͺ½ μλ¨μ 보μλ©΄ + λ²νΌμ΄ μμ΅λλ€. μ΄ λ²νΌμ ν΄λ¦νμκ³ 'New Repository'λ₯Ό ν΄λ¦ν©λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3a00bb5d-4050-408e-a917-b57ac40e12bf%2FUntitled.png?table=block&id=e1bd70ca-1ff3-488c-9332-f6869f5fab85&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb4dff0a0-71a6-4535-b124-8feb147d5a2c%2FUntitled.png?table=block&id=eb5973b2-f9bb-44b5-ab5f-c28648c5aeb0&cache=v2)
Repository name(μ μ₯μ μ΄λ¦)μ μ
λ ₯ν΄μ€λλ€. Descriptionμ κ°λ¨ν μ€λͺ
μ μ
λ ₯νμ
λ μ’μ΅λλ€. μ νμ¬ν(optional)μ
λλ€.
κ·Έλ¦¬κ³ Public μ μ₯μκ° μλλΌ Private μ μ₯μλ₯Ό μμ±νκ² μ΅λλ€. Create Repository λ²νΌμ λλ₯΄λλ‘ νκ² μ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F86cbff42-b69b-4705-8e12-6e5841b88b85%2FUntitled.png?table=block&id=8b23d779-23bd-49cf-a5fb-d9725d4acc50&cache=v2)
Β
GitHub Repositoryλ₯Ό μμ±νκ² λλ©΄ 첫 λ²μ§Έ νμ΄μ§μ ν°λ―Έλμ ν΅ν΄ μ΄λ»κ² Gitμ μΈν
ν΄μΌνλμ§ μμ±λμ΄ μμ΅λλ€. μ΄ λͺ
λ Ήμ΄λ€μ ν°λ―Έλμ μ
λ ₯νμλ©΄ λ©λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff0624dd8-051c-4e48-8afb-7ed71cff7beb%2FUntitled.png?table=block&id=ac42ebdb-875f-4302-bcd3-687a88e90826&cache=v2)
Β
2. νλ‘μ νΈμ Git μ€μ
μ°μ κ΅¬λ¦ IDEμ μ μν©λλ€. μμ±λ 컨ν
μ΄λκ° μλ κ²μ νμΈν μ μμ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0f01976c-af13-4fee-88fb-3e189eaa3595%2FUntitled.png?table=block&id=58f8e97c-e40b-4d12-95f9-c7ab0acaa687&cache=v2)
Β
μ€ν λ²νΌμ λλ¬μ λ°λ‘ μ¬μ€ μλ μμ§λ§ GitHubμ ν°λ―Έλμμ λλΆλΆμ μμ
μ μ§νν μ μκΈ° λλ¬Έμ 컨ν
μ΄λλ₯Ό ν°λ―Έλλ‘ μ€νμ ν΄λ³΄λλ‘ νκ² μ΅λλ€.
Β
ν°λ―Έλμ΄ μ€νμν€κ³ ls λͺ
λ Ήμ΄λ₯Ό μ
λ ₯ν©λλ€.
root@goorm:/workspace/instaclone# ls
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F043135a3-d542-4efb-9045-bc33d38a6412%2FUntitled.png?table=block&id=6d9c39da-99a1-4ef0-ab3a-f5d1b87e8087&cache=v2)
Β
instaclone
ν΄λκ° λ³΄μ΄κ² λ©λλ€. instaclone
ν΄λ μμΌλ‘ λ€μ΄κ°λλ‘ νκ² μ΅λλ€.root@goorm:/workspace/instaclone# cd instaclone/
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd58baf4f-e136-4917-87d8-59815776c8b4%2FUntitled.png?table=block&id=94dc4946-b57b-4b25-b9dd-f6dbe19f5135&cache=v2)
Β
instaclone
μλμ μλ νμΌλ€μ λ³νλ₯Ό μΆμ νκΈ° μν΄ λ²μ κ΄λ¦¬ μ§ννλλ‘ νκ² μ΅λλ€. μ°μ , μ΄λ€ νμΌμ΄ μλμ§ νμΈν©λλ€.root@goorm:/workspace/instaclone/instaclone# ls
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fdbbe9edd-fd29-45f1-8f61-bd69f783761a%2FUntitled.png?table=block&id=ee481c83-2b02-4238-8425-93598903a163&cache=v2)
Β
venv
ν΄λλ μΆμ νμ§ μμ κ²λλ€. λ€λ₯Έ κ³³μμ μμ
μ ν λλ κ°μ νκ²½μ μλ‘ λ§λ€ κ²μ΄κΈ° λλ¬Έμ
λλ€.Β
Gitμ μ¬μ©νκΈ° μμ, λ¨Όμ μ΄κΈ°νλ₯Ό μν€κ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git init
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc5868a1b-477c-4705-b8fd-12e67c2ca0e6%2FUntitled.png?table=block&id=c512123b-1845-4f85-a729-6b25f180cd7a&cache=v2)
Β
ν΄λμ μ΄λ€ λ³νκ° μλμ§ νμΈνκ² μ΅λλ€. ls λͺ
λ Ήμ΄λ₯Ό μ
λ ₯νμλ©΄ λ³νκ° μλ κ²μ νμΈν μ μμ΅λλ€.
git initμ μννλ©΄
.git
ν΄λκ° μμ±λλλ° μ΄ νμΌμ μ¨κΉνμΌμ΄λΌ κΈ°λ³Έμ μΈ ls λͺ
λ Ήμ΄λ‘ νμΈ ν μ μμ΅λλ€. λμ , -a λλ -al μΆκ° μ΅μ
μ μ£Όλ©΄ μ¨κΉνμΌμ νμΈν μ μμ΅λλ€.root@goorm:/workspace/instaclone/instaclone# ls - a root@goorm:/workspace/instaclone/instaclone# ls -al
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F166ef090-feaa-4f0e-af06-5251d39030b7%2FUntitled.png?table=block&id=4563b1f6-7bf7-4f1f-ac4b-e0dd3bb94ea4&cache=v2)
Β
.git
μ΄λΌλ ν΄λκ° μλ‘ μκΈ΄ κ²μ λ³Ό μ μμ΅λλ€. μ΄ μμ μλ νμΌλ€μ΄ μ΄ ν΄λ μμ λ³νλ€μ μΆμ ν κ² λ κ²μ
λλ€.Β
3. Git μ¬μ©νκΈ°
Gitμ΄ μ΄λ€ νμΌλ€μ μΆμ νκ² λ μ§ λͺ
ννκ² μλ €μ€μΌ ν©λλ€.
root@goorm:/workspace/instaclone/instaclone# git status
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F23ae6239-3a14-4bdb-806b-7572c13d94c5%2FUntitled.png?table=block&id=3da07423-ea08-4a50-8432-c1f2583ad802&cache=v2)
Β
'Untracted files' λΌκ³ μμ΅λλ€. λΉ¨κ°μμΌλ‘ νμλ κ²μ μμ§ μΆκ°κ° μ λ νμΌκ³Ό ν΄λμ
λλ€.
κ΄λ¦¬ν νμΌμ΄λ ν΄λλ₯Ό μΆκ°ν ν git status κ° μ΄λ»κ² λ³νλμ§ λ³΄κ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git add config/ root@goorm:/workspace/instaclone/instaclone# git status
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fcf869da2-8564-4037-ad93-4a274104d6ec%2FUntitled.png?table=block&id=fa8f56e4-16d6-4c01-a147-01bd194a283e&cache=v2)
Β
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
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F12cb4149-6701-4890-a350-b73be24674bd%2FUntitled.png?table=block&id=ea26dddc-1fe5-443b-8041-b2af68a581cb&cache=v2)
Β
μ΄μ μνλ νμΌλ€μ λ³νλ₯Ό μΆμ ν μ μμ΅λλ€.
μ΄λ¬ν λ³κ²½μ¬νλ€μ commit ν΄μΌ ν©λλ€. νμΌμλ€κ° μ΄λ€ κ²μ μμ νλμ§ κ°λ¨ν λ©λͺ¨λ₯Ό λ¨κΈ°λ κ²μ
λλ€.
root@goorm:/workspace/instaclone/instaclone# git commit -m "first commit"
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F82eed909-d763-4ba4-9f33-dc31276efacc%2FUntitled.png?table=block&id=a4c41c21-b5e4-46f3-b526-87eafe184177&cache=v2)
νμ§λ§ μ²μμλ 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
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fa9f81a49-0865-406e-9d7c-496472a00b58%2FUntitled.png?table=block&id=22159761-2dea-4c98-b901-0fee3400c51b&cache=v2)
Β
λ€μ commitμ μλνλ©΄ λ©λλ€. μ΄λ λ€μ νμ΄ννμ€ νμλ μμ΅λλ€. μλνλ©΄, ν°λ―Έλ μ°½μμ νμ΄ν λ°©ν₯ν€ β λ₯Ό μ
λ ₯νλ©΄ μμ μ μ
λ ₯νλ λͺ
λ Ήμ΄λ₯Ό μλμΌλ‘ μμ±ν΄μ€λλ€.
root@goorm:/workspace/instaclone/instaclone# git commit -m "first commit"
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4bc84b08-d1ec-40ca-82bf-24a4422f3073%2FUntitled.png?table=block&id=c43521ba-7287-4db4-adfa-d92f474dff9e&cache=v2)
Β
μ΄μ commitμ΄ μ λ κ²μ λ³Ό μ μμ΅λλ€. κ·Έλ¬λ©΄ μ¨λΌμΈμ μλ μμ μ GitHub 곡κ°κ³Ό μ°κ²°μν¬ κ²μ
λλ€.
root@goorm:/workspace/instaclone/instaclone# git remote add origin https://github.com/"μμ μ μ μ₯μ μ£Όμλ₯Ό μ°Έκ³ "
Β
μ΄λ€ μ£Όμλ₯Ό λ£μ΄μΌ ν μ§ λͺ¨λ₯΄κ² λ λΆμ μ²μ GitHub Repository μμ± μμ λ΄€λ νμ΄μ§μ κ·Έλλ‘ λμ μμΌλ μ°Έκ³ νλ©΄ μ’μ κ² κ°μ΅λλ€. μ΄λ, μμ μ μ£Όμλ₯Ό μ
λ ₯ν΄μΌ ν©λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F30331208-7cf0-420c-8df5-fce3b5a81464%2FUntitled.png?table=block&id=db2f723e-b6c6-49cd-b8e9-86f61c171921&cache=v2)
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9e76b68e-a76a-4513-99ef-a3c124609b15%2FUntitled.png?table=block&id=f2b0f7b1-66ca-42ba-90cb-4ad8682684b2&cache=v2)
Β
κ΅¬λ¦ IDEμ ν°λ―Έλμμλ λ³΅μ¬ λλ λΆμ¬λ£κΈ° λ¨μΆν€κ° λ€λ₯΄λ€λ κ² μ°Έκ³ νμκΈΈ λ°λλλ€. Shift ν€λ§ μΆκ°μ μΌλ‘ λλ₯΄μλ©΄ λ©λλ€.
λ³΅μ¬ : Ctrl + Shift + C
λΆμ¬λ£κΈ° : Ctrl + Shift + V
Β
μμ
νκ³ commitν λ΄μ©λ€μ μ μ₯μμ μ
λ‘λνλλ‘ νκ² μ΅λλ€.
root@goorm:/workspace/instaclone/instaclone# git push -u origin master
Β
μμ μ GitHub Usernameκ³Ό λΉλ°λ²νΈλ₯Ό μ
λ ₯ν΄μ€λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff5c48a79-94f4-403a-9805-e5cc1ba96883%2FUntitled.png?table=block&id=b5963b35-05eb-4426-ba07-65f526fd3edf&cache=v2)
Β
μ±κ³΅μ μΌλ‘ pushκ° λ κ²μ λ³Ό μ μμ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F58c18b61-aa3d-48cd-9706-253804f8bec6%2FUntitled.png?table=block&id=75c44b47-4f2b-4375-a66b-9abe888dce74&cache=v2)
Β
μ μ
λ‘λ λμλμ§ νμΈνκΈ° μν΄ GitHub Repositoryλ₯Ό μ΄ν΄λ³΄κ² μ΅λλ€. GitHub νμ΄μ§λ₯Ό μλ‘κ³ μΉ¨νλ©΄ pushν κ²μ νμΈν μ μμ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd41ce2be-44b8-4b47-8334-60c88919cd47%2FUntitled.png?table=block&id=f180bc57-c9db-475b-bf33-838bee8347e7&cache=v2)
Β
commit λ²νΌμ λλ¬λ³΄κ² μ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc4d734ee-c04b-4b8a-aa72-3b3420ea10ae%2FUntitled.png?table=block&id=f219c1db-c10d-4e6e-8c88-e76e3ce81f78&cache=v2)
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F943e2769-2916-430b-98c6-7d7da055e23c%2FUntitled.png?table=block&id=490bbd4b-a530-4b01-92b7-78333d156e60&cache=v2)
Β
commit λ©μμ§ "first commit"μ΄ λ³΄μ
λλ€. μ΄λ° λ°©μμΌλ‘ commitλ€μ΄ μμ΄λ κ²μ
λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fe6b82165-da19-40ac-bbb0-a55be79a8fab%2FUntitled.png?table=block&id=bb9624c1-61d5-4643-9ce3-f9c9602a88f1&cache=v2)
Β
commitμ νμ©νλ©΄ λ¬Έμ κ° μκ²Όμ λ, λ¬Έμ κ° μμλ μμΉλ‘ λλ릴 μ μμ΅λλ€.
μ¬λ¬λΆμ΄ λ§μ§λ§μΌλ‘ commit νμ λλ μ€λ₯κ° μμλλ° μμ
νκ³ λ³΄λ μ€λ₯κ° μκ²ΌμΌλ©΄ λ§μ§λ§ commit λ΄μ©μΌλ‘ λλ릴 μ μμ΅λλ€.
Β
κ΅¬λ¦ IDEλ‘ κ°μ, μκΉ μ€λ₯κ° λ¬λ λΆλΆ '*' λ₯Ό μ§μμ λ€μ μ€λ₯κ° λλλ‘ λ°κΏλ³΄κ² μ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1fa473e7-f724-4a93-b65e-7ef8413e42b3%2FUntitled.png?table=block&id=ed9f3e0b-e26c-4380-9737-72ffacaa9169&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F953e6f54-1a07-4a25-a8ef-a208126aa2cf%2FUntitled.png?table=block&id=3f2dbcf6-3ed4-4f36-b58c-8033ae7a87aa&cache=v2)
Β
μ μ₯νμ λ€μ μλ²λ₯Ό μΌκ³ URLμ ν΅ν΄ μ μνλ©΄ λ€μ μλ¬κ° λνλ©λλ€.
(venv)root@goorm:/workspace/instaclone/instaclone# python manage.py runserver 0:80
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc04c6c31-d99d-4202-ba43-1b15b5504419%2FUntitled.png?table=block&id=bc9a2046-4aaa-45f1-92dd-ccf067c05b83&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fcc1b0051-2406-464d-92c2-bd8dcb0c470c%2FUntitled.png?table=block&id=1c76ef7d-82d9-4913-b064-66418efe9e8d&cache=v2)
Β
νμ¬ μν©μμ κΈλ°© ν΄κ²°ν μ μλ μλ¬μ΄μ§λ§ λ§μ μμ μ½λμ νμΌμ μμ ν μν©μμλ μλ¬λ₯Ό μμ νκΈ° μ΄λ ΅μ΅λλ€. μ΄λ, κ°λ¨νκ² λͺ¨λ λ³κ²½ μ¬νμ μ΄κΈ°νμν€λ κ²μΌλ‘ μ²μλΆν° λ€μ μμν μ μμ΅λλ€.
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4e7a31cf-8e27-4421-9d64-4c856a67faf4%2FUntitled.png?table=block&id=0e4bd0ce-4704-456e-9859-13a87f7ab987&cache=v2)
Β
μ μ¬μ§μ²λΌ ν°λ―Έλμμ μλ²κ° μλλκ³ μλ€λ©΄ ν°λ―Έλμμ Ctrl + c λλ¬μ μλ²λ₯Ό λλλ€. κ·Έλ¬λ©΄ λ€μ ν°λ―Έλμ΄ λͺ
λ Ήμ΄λ₯Ό λ°λ μνλ‘ λμμ΅λλ€.
Β
μ΄μ λ€μ λͺ
λ Ήμ΄λ‘ commitμ λλλ €λ΄
μλ€.
root@goorm:/workspace/instaclone/instaclone# git reset --hard
Β
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F7e652cee-7f8a-401f-b0c2-cfb10b1a79be%2FUntitled.png?table=block&id=f018e35c-2bfd-48a3-aace-3fc6c67a566c&cache=v2)
Β
'*'κ° λμμμ΅λλ€. "first commit" νλ μνλ‘ λ³ν κ²μ μ μ μμ΅λλ€.
Β
μ΄λ κ² μμ μ νμΌμ μ΄μ λ²μ μΌλ‘ 볡ꡬν μ μμ΅λλ€. μ¬λ¬λΆλ€λ κ³Όμ μ λ°λΌνμλ€κ° λ¬Έμ κ° μκΈ°κ³ λ κ·Έ λ¬Έμ λ₯Ό ν΄κ²°νμ§ λͺ»νμκ² λ€λ©΄ μ΄λ¬ν λ°©λ²μΌλ‘ λλλ €μ λ€μ μμν μ μμ΅λλ€.
Β