Git 정리

황은하·2023년 7월 31일

Git

목록 보기
1/1

1. git 초기화

$ git init

만약, main 대신 master라면,

$ git config --global init.defaultBranch main

입력 후 .git 폴더를 제거하고 현재 bash를 닫고 다시 연 뒤 1을 다시 진행한다.


2. user.name과 user.email을 설정한다.

$ git config --global user.name 'username'
$ git config --global user.email 'useremail'

3. stage에 파일 올리기

$ git add .

오류 발생 시

warning: in the working copy of 'JavaTest/bin/.gitignore', LF will be replaced b
y CRLF the next time Git touches it

발생 시 아래 입력하면 해결 가능

git config --global core.autocrlf true


4. stage에 있는 파일 확인하기

$ git status

5. 커밋하기

$ git commit -m 'commit message'

6. 커밋 기록 보기

$ git log

7. 원격 리포지토리 등록하기

$ git remote add origin 주소
$ git remote -v

7.1. 원격 리포지토리 주소 변경하기

$ git remote set-url origin 주소

8. 원격 리포지토리에 파일 올리기

$ git push origin main

9. 원격 리포지토리에서 파일 다운받기

$ git clone 주소

$ git pull origin main

profile
차근차근 하나씩

0개의 댓글