얍 ! 그렇다.
Git은 나의 개인 로컬 머신에 저장된 소프트웨어이고
GitHub 은 Git의 repositories 을 인터넷 클라우드를 이용해 다른 사람들과 함께 작업할 수 있게 도와주는 서비스다.
이렇게 Git을 다른사람과 협업할 수 있게 도와주는 서비스는 GitHub 외에도 소스트리 등등 있다.
하지만 많은 사람들이 주로 쓰는 것이 깃허브이기 때문에 깃허브를 사용해본다.
내 개인 로컬(컴퓨터)에 만들어 놓은 git repository을 GitHub에 올리는 것을 push 라고 하는데
그러면 모든 커밋, 머지 등의 기록이 함께 GitHub 클라우드에 올라간다.
만일 다른 사람이 나의 repo을 쓸일 있다면 복제해서 사용하면 되는데 이때 이걸 clone이라고 한다.
그럼 위에 repo가 clone 된다.
Github 으로 Push 하기
1. GitHub 계정 만들기
GitHub.com Help Documentation
docs.github.com
이 문서들을 참고해서 계정을 만든다.
한국어 지원은 없다.
2. remote : git remote add 부를이름 만든repo주소
본격적으로 push을 하기전에 우리의 git 에 우리가 쓰게될 github 에 대해서 알려줘야한다.
그러기 위해서 github 에서 new repository 을 누른 후
가장 기본값으로 repo이름만 정하고 create repostiory 버튼을 누른다.
그럼 다음화면이 뜨는데 github에서 생성한 HTTPS URL주소를 복사한다.
그리고 터미널에서 내가 올리고자 하는 repository가 있는 폴더로 간다.
나는 지난 포스팅에 올린 mypractice 을 사용해볼 것이다.
우선 나의 깃에 깃허브 주소를 추가한다.
git remote add foodie https://github.com/이름/food-that-i-love.git
git remote -v
foodie https://github.com/이름/food-that-i-love.git (fetch)
foodie https://github.com/이름/food-that-i-love.git (push)
foodie 에 나의 깃허브 주소를 입력해둔다.
3.push : git push 부를이름 branch1 branch2 branch3
깃허브에 내가 올리고 싶은 branch 을 올린다. 나는 한번에 모든 branch를 올렸다.
git push foodie drinking foodmarket master
Enumerating objects: 33, done.
Counting objects: 100% (33/33), done.
Delta compression using up to 10 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (33/33), 3.01 KiB | 3.01 MiB/s, done.
Total 33 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5), done.
To https://github.com/이름/food-that-i-love.git
* [new branch] drinking -> drinking
* [new branch] foodmarket -> foodmarket
* [new branch] master -> master
이렇게 github 에 나의 로컬에 있던 mypractice 폴더를 push 했다.
다음은 clone 을 해보자
'TIL > Git & Github' 카테고리의 다른 글
[TIL][Git][CLI] GitHub 랑 Git 이랑 다른 거야? - 3. fetch / pull 하기 (0) | 2022.04.29 |
---|---|
[TIL][Git][CLI] GitHub 랑 Git 이랑 다른 거야? - 2.clone 하기 (0) | 2022.04.28 |
[TIL][Git][CLI] GIT으로 뭘할건데? - 4. merge 합치기! 삼단변신! (0) | 2022.04.27 |
[TIL][Git][CLI] GIT으로 뭘할건데? - 3. 새로운 Branch 에서 커밋하기 (0) | 2022.04.27 |
[TIL][Git][CLI] GIT으로 뭘할건데? - 2. 커밋하기 ( Commits) 파일수정해서 커밋하기 (0) | 2022.04.27 |