Github remote repository 연결 및 끊기 (VSCode)

유지연·2023년 11월 22일
0

👋 local repo에 remote repo를 연결하고 끊는 방법을 알아보자! (TIL 231122)


git의 작동 구조

  • 내가 작업한 것을 (local repository)
  • 원격 저장소로 밀어내거나 (push)
  • 원격 저장소에서 최신 버전을 내 작업 공간으로 당겨옴 (pull)

github에서 repository 생성

local repository에 remote repository를 연결하려면 우선 repo를 생성 해야 한다.
https://github.com/ -> Create a new repository
(이 부분은 어렵지 않아 자세한 내용은 생략...!)

💡 git remote

vscode로 작성한 프로젝트의 경우 Terminal > New Terminal

$ git init
$ git remote add origin <repo url>
$ git remote get-url origin #url 가져오기

💡 remote repository 연결 끊기

git remote -v 명령어를 통해 현재 연결되어 있는 원격 레포 확인

C:\Users\WIN10\Desktop\study\learning-react> git remote -v
origin  https://github.com/jiyeonyooo/https---github.com-jiyeonyooo-Learning-React.git (fetch)
origin  https://github.com/jiyeonyooo/https---github.com-jiyeonyooo-Learning-React.git (push) 

git remote remove origin 명령어로 연결 끊기

C:\Users\WIN10\Desktop\study\learning-react> git remote remove origin
C:\Users\WIN10\Desktop\study\learning-react> git remote -v

[내용 참고] https://ifuwanna.tistory.com/263
[사진 출처] https://velog.io/@everydamnday/git-%EC%A0%95%EB%A6%AC

profile
Keep At It

0개의 댓글