매일 땡기는 마라 코딩

git hub 대용량 파일 push 본문

카테고리 없음

git hub 대용량 파일 push

cmkoi1 2023. 2. 14. 00:53

git bash 다운로드

 

Git for Windows

Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git BASH Git for Windows provides a BA

gitforwindows.org

대용량 파일 업로드

 

Git Large File Storage

Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.

git-lfs.com

 

올릴 프로젝트 파일 내에서 Shift+F10, Git Bash Here 클릭

 

1. 깃 파일 생성

git init

2. 대용량 파일 업로드 관련 프로그램 다운

git lfs install

 

3. 대용량 파일 등록

git lfs track "*"

4. 파일 생성/변경/삭제를 git 인덱스에 추가

git add .

 

5. 업로드 내용 관련 주석

git commit -m "test"

 

6. 원격 저장소 주소 지정

git remote add 브랜치명 https://github.com/cmkoi1/YouTubeClone.git

 

7. push

git push origin 브랜치명

 

옵션

-f, --force: 로컬 브랜치 내용으로 리모트 브랜치 내용을 덮어쓰기. 강제 업데이트

$ git push -f origin test

 

 

 


로컬 "local" 브랜치를 리모트 "remote" 브랜치로 푸시하는 법

 

$ git push origin rank:master

 

 

 

 

 

git이 로컬에서 test 브랜치를 찾지 못해 발생하는 오류

 

error: src refspec test does not match any error: failed to push some refs to 'origin'

 

1. 로컬 저장소에 "test" 브랜치가 있는지 확인

$ git branch

 

1-1. 없다면 만든다

$ git branch test

 

1-2. 해당 브런치로 이동한다

$ git checkout -b test

 

2. 있다면 로컬과 리모트가 일치하는지 확인한다(현재 브랜치와 연결된 리모트 브랜치 확인)

$ git branch -vv

 

2-1. 연결되어있지 않다면 명령어로 연결

$ git branch --set-upstream-to=origin/test test

 

3. push

$ git push origin test

 

 

 

 

 

 

로컬 저장소 최신 상태 업데이트

 

$ git pull origin test

 

 

 

 

로컬 브랜치의 이력을 강제로 리모트 브랜치의 이력으로 업데이트

 

$ git pull origin test --allow-unrelated-histories

로컬 파일의 내용이 바뀔 수 있음

 

 

 

 

728x90