git bash 이용해 코드 올리는 법

soyun woo·2022년 10월 16일
0

git bash로 githurb에 코드 올리는 법

  • git bash
    프로젝트 폴더 우클릭 > git bash Here
    프로젝트 파일 내 '.git' 폴더 생성됐는지 확인

  • 로컬 저장소 지정

$ git init

  • 로컬 저장소 상태 확인
    • 빨간 글씨로 뜨는 것은 한번도 add/commit되지 않은 것
$ git status

  • 브랜치 이름 변경
$ git branch -m [기존 이름][바꿀 이름]

  • 작업 공간 파일을 준비 영역에 추가
$ git add .

만약, 에러가 뜨면 아래의 코드 입력 후 add할 것

$ git config core.autocrlf true

  • commit : 로컬 저장소 저장
$ git commit -m "입력할 메세지"

  • 로컬 저장소와 원격 저장소 연결
$ git remote add origin "(Git Repository 주소)"
# ex) https://github.com/apricityun/tp-spring01.git

  • 별칭 확인
$ git remote -v

  • push : 로컬 저장소 파일 -> 원격 저장소
$ git push origin master
$ git push -u origin master

  • 깃 username 및 토큰 입력

    • username : apricityun
    • token : (깃허브에서 발급받은 토큰 입력)

  • 깃 push 안 될 때,

git pull origin 브랜치명
git branch -a   #강제 푸시
git push origin +master

git checkout -b 'master'
git push origin master

0개의 댓글