local directory를 git repo와 연동하기

2021. 3. 6. 01:28coding

반응형

git 너무 어려워서 git 명령어로 안 하고 항상 홈페이지에서 직접 drag & drop 으로 파일 업로드하곤 했는데 .. 

그렇게 업로드하는데는 파일 크기에 제한이 있더라 

큰 파일 올리려고 어쩔 수 없이 git에 도전하게 되었다 ......... 

전에 분명 배웠는데.. 정리한 메모를 잃어버려서 내 기억도 잃어버렸다 

 

1. terminal에서 git과 연동하고 싶은 directory로 이동한다 

2. git init 실행하면 .git 파일이 생긴다 

3. git status로 상태 확인 (untracked files 확인)

4. git pull --rebase origin main, add 하기 전에 pull 먼저 해야 한다는 이야기가 있네

5. git add <filename>, 한 번에 다 추가하고 싶으면 git add . 

6. git commit -m '아무 메시지'

7. git push --set-upstream origin master, github 로그인하라고 뜨면 로그인하면 됨. 근데 새로운 창 떠서 로그인하면 계속 Logon failed래. 다시 한 번 기회를 줘서 terminal에 아이디, 비번 치면 또 로그인이 된다. 왜 저러는건지?

 

아 짜증나

error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: Unknown error code (err 8)

이런게 떠서 찾아보니 또 파일 크기 때문이라네 

 

git config --global http.postBuffer 524288000

 

이걸로 버퍼 사이즈 늘려주고 push 하면 될 줄 알았는데!!!!!! 또 안돼! 

이번엔 파일 크기 때문이라면서 lfs를 써보라고 제안까지 해준다 

손수 알려준 url로 가서 git-lfs.github.com/

 

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.github.com

git lfs install

git lfs track <엄청 커서 나를 잠 못자게 하는 짜증나는 파일의 이름>

add, commit ....

다시 push를 해준다 ... 제발 ..

어느 순간부터 코딩하다가 기도를 하게 된다 

 

또 안 됨 ;;

 


evidencen.com/how-to-upload-large-files-100mb-to-github/#:~:text=To%20upload%20files%20larger%20than%20100mb%20to%20github%2C%20you%20will,on%20your%20own%20personal%20repo.

 

How to upload large files (100mb+) to Github – EvidenceN

How to upload large files (100mb+) to GithubEvidenceN | How to upload files up to 25mb to Github.If you want to upload files that are up to 25mb in size, you can upload it using the command line just like you would push anything else to githubBut, you can

evidencen.com

이 글을 읽어보니까

지금까지 git lfs 설치도 안 하고 무작정 따라한건가보다;;

 

1. git lfs 설치하기 https://github.com/git-lfs/git-lfs/releases/download/v2.11.0/git-lfs-windows-v2.11.0.exe

2. git lfs install

3. git lfs track <엄청 큰 파일 이름>

4. git add .gitattributes

5. git add <엄청 큰 파일 이름>

6. git commit -m '기쁨의 커밋 메시지'

7. git push origin main

* main과 master가 뭔 차이인지 모르겠다

* 뭔가 잘 안 되면 -f force 옵션 주면.. 된다.. rebase 때문이라는데 이해 못함 ㅋ  

 

이것도 또 안 돼서 다른 stackoverflow 글을 참고했다. 그 글은 어디갔는지 링크 까먹음

 

1. git lfs migrate info
2. git lfs migrate import --include="*.bin"
3. git push origin main -f

 

드디어 진짜진짜 성공

반응형