vscode와 github연동 방법

epiphany·2022년 10월 19일
0

Git

목록 보기
2/2
post-thumbnail

📌 vscode가 설치되어있고 github에 리파지토리가 생성되어있다는 전제하에 작성

  • Java공부를 시작하면서 Programmers School의 코딩 연습 문제를 풀고 github에 지속적으로 등록하기 위해 vscode와 연동함
  • vscode와 github의 연동 방법은 많이 나와있음 (참고확인)

💻 방법

  1. 아래 링크에서 git 다운로드
    https://www.git-scm.com/downloads

  2. vscode 상단의 터미널 > 새 터미널 클릭 후 보이는 터미널의 오른쪽에 + 클릭하여 Git Bash 터미널 오픈

  3. git remode add origin [자신의 github repository 링크]
    링크는 아래처럼 확인 가능

  4. vscode에서 왼쪽 소스제어 클릭

  5. 커밋할 파일을 + 버튼으로 추가 후 상단의 체크 버튼 클릭

    📌 메시지('master'에서 커밋할 Ctrl+Enter)부분에 메시지를 작성하지 않으면 무한 로딩이 됨 ->

☝ 이거 한적어서 한참 헤맸다ㅜㅜ...

  1. 터미널에 아래 명령어 차례로 입력

    $ git remote -v  # 위에 remote add가 잘되었는지 확인
    origin  https://github.com/Kwonsofia/Algorithm.git (fetch)
    origin  https://github.com/Kwonsofia/Algorithm.git (push)
    
    $ git init
    Reinitialized existing Git repository in C:/Users/.../myproject/programmers/Algorithm/.git/
    
    $ git pull origin master  # 바로 push하면 오류 발생하는 경우가 있어 pull먼저(업데이트한 부분과 겹치지 않도록 기존에 있던작업 가져오기)
    From https://github.com/Kwonsofia/Algorithm
     * branch            master     -> FETCH_HEAD
    Already up to date.
    
    $ git push origin master  # github로 업로드
    Enumerating objects: 11, done.
    Counting objects: 100% (11/11), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (9/9), done.
    Writing objects: 100% (9/9), 962 bytes | 962.00 KiB/s, done.
    Total 9 (delta 4), reused 0 (delta 0), pack-reused 0
    remote: Resolving deltas: 100% (4/4), completed with 1 local object.
    To https://github.com/Kwonsofia/Algorithm.git
       c39a883..7fa6ab5  master -> master



📖 참고

0개의 댓글