[GitHub]GitHub Repo를 연결해보자
🦥 GitHub
-
먼저 자신의 github 홈페이지에서 repository를 생성하자.

- VM에 접속하여 host로 로그인
vagrant sshC:\Users\KyungHan\vm-projects\centos>vagrant ssh Last login: Mon Nov 21 05:26:06 2022 from 10.0.2.2 Last login: Mon Nov 21 05:26:06 2022 from 10.0.2.2 [vagrant@host1 ~]$ mkdir명령어를 통해 repo생성한 이름과 같이 생성하고cd로 들어간다.[vagrant@host1 git]$ cd bitcamp-ncp3 [vagrant@host1 bitcamp-ncp3]$git init을 통해.git저장소를 만든다.ls -a,ls-al을 통해 숨김파일임을 확인할 수 있다.Git Pull
git pull https://github.com/kyunghan1/bitcamp-ncp3- git pull과 다음은 자신의 repositories url을 입력해 원격 저장소의 데이터를 가져온다.
Git Remote
git remote add origin https://github.com/kyunghan1/bitcamp-ncp3git clone하면 훨씬 더 쉬움- git remote add options url 순으로 입력한다.
git remote -v를 통해 연결되었는지 확인한다.[vagrant@host1 bitcamp-ncp3]$ git remote -v origin https://github.com/kyunghan1/bitcamp-ncp3 (fetch) origin https://github.com/kyunghan1/bitcamp-ncp3 (push) [vagrant@host1 bitcamp-ncp3]$- 본인의 Repository Brach가
master인지main인지 확인하고 알맞게 변경한다.[vagrant@host1 bitcamp-ncp3]$ git branch master [vagrant@host1 bitcamp-ncp3]$ git branch -m main [vagrant@host1 bitcamp-ncp3]$ git branch main push확인을 위해nano혹은vi로 아무파일(a.txt)이나 생성하고add,commit을 수행한다.
Git Push
git push origin main을 입력하고 본인의 닉네임과 토큰키를 적는다[vagrant@host1 bitcamp-ncp3]$ git push origin main Username for 'https://github.com': kyunghan1 Password for 'https://kyunghan1@github.com':Repositories 반영 확인

Leave a comment