본문 바로가기

web

Git - 자주쓰는 명령어 모음

 

 

 

GitHub에 올리는 목적으로 Git을 사용하다보면 자주쓰게 되는 명령어들이 있다.

한번에 정리해두고자 이렇게 포스팅을 한다.


 

 

GitHub 로그인

  • git config --global user.email "이메일"
  • git config --global user.name "사용자명"

 

GitHub 로그

  • git config --global --unset-all user.name
  • git config --global --unset-all user.email
  • git config --system --unset-all credential.helper

깃 로컬 저장소 지정

  • git init

 

깃 파일 추가

  • git add 파일명
  • git add . >> 파일 전부다 추가하기

 

커밋메세지 작성

  • git commit -m "커밋내용"

 

깃허브 저장소 등록

  • git remote add origin 깃허브저장소주소

깃허브에 올리기

  • git push origin master

 

git push origin master 오류날시 (첫번째 명령어부터 시도해본다)

  • git push -f origin master
  • git pull > git push -f origin master
  • git push -u origin master

원격저장소,로컬저장소 파일 삭제하기 :

  • git rm 'File Name'
  • git commit -m "remove 파일명"
  • git push

 

원격저장소에 있는 파일만 삭제하기:

  • git rm --cached 'File Name'
  • git commit -m "remove 파일명"
  • git push

 

warning: CRLF will be replaced by LF in some/file.file. The file will have its original line endings in your working directory 오류

 

 

Git 에러 CRLF will be replaced by LF (혹은 반대) 핸들링하는 방법

맥/리눅스 이용 개발자와 윈도우 개발자가 협업할 때 왜 발생할까? 터미널에 git 명령어를 입력했는데 다음과 같은 에러가 뜨는 경우가 있다: ```bash warning: CRLF will be replaced by LF in some/file

blog.jaeyoon.io