먼저 깃허브에서 repository를 생성한다
그러면 repository 주소를 얻을 수 있다.
https://github.com/xxxxx/QnA_mave.git
이제 로컬에 업로드할 주소로 이동한다.
그리고 그 폴더 안에서 깃 초기화 한다.
root@Ubuntu22Docker:test_mave#git init
힌트: Using 'master' as the name for the initial branch. This default branch name
힌트: is subject to change. To configure the initial branch name to use in all
힌트: of your new repositories, which will suppress this warning, call:
힌트:
힌트: git config --global init.defaultBranch <name>
힌트:
힌트: Names commonly chosen instead of 'master' are 'main', 'trunk' and
힌트: 'development'. The just-created branch can be renamed via this command:
힌트:
힌트: git branch -m <name>
/root/share/share_219/chain_lang/rag/test_mave/.git/ 안의 빈 깃 저장소를 다시 초기화했습니다
그리고 필요하다면 git config를 설정해준다
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
config list 도 확인 가능
root@Ubuntu22Docker:test_mave#git config --list
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/xxxxx/QnA_mave.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
user.email=xxxxx@gmail.com
user.name=xxxxx
branch.main.remote=origin
branch.main.merge=refs/heads/main
지금까지의 git 상태도 확인 가능하다
root@Ubuntu22Docker:test_mave#git status
현재 브랜치 main
브랜치가 'origin/main'에 맞게 업데이트된 상태입니다.
커밋하도록 정하지 않은 변경 사항:
(무엇을 커밋할지 바꾸려면 "git add/rm <파일>..."을 사용하십시오)
(작업 디렉토리의 변경을 무시하려면 "git restore <file>..."을 사용하시오)
삭제함: README.md
추적하지 않는 파일:
(커밋할 사항에 포함하려면 "git add <파일>..."을 사용하십시오)
test_mave/
커밋할 변경 사항을 추가하지 않았습니다 ("git add" 및/또는 "git commit -a"를
사용하십시오)
git remote add origin https://github.com/xxxxx/QnA_mave.git
명령어는 로컬 저장소와 원격 저장소를 연결하기 위해 사용. 이렇게 설정하면
local 변경사항을 github에 push, github 변경사항을 local로 pull 할 수 있다.
(여기서 origin은 github 이름, master는 github의 주 branch 이름)
e.g.) git push origin master, git pull origin master
git remote add origin https://github.com/xxxxx/QnA_mave.git
만약, 이미 origin이 이미 있다면 origin 확인후 제거하고 다시 만들면 된다.
error: origin 리모트가 이미 있습니다.
root@Ubuntu22Docker:test_mave#git remote -v
origin https://github.com/xxxxx/QnA_mave.git (fetch)
origin https://github.com/xxxxx/QnA_mave.git (push)
root@Ubuntu22Docker:test_mave#git remote remove origin
root@Ubuntu22Docker:test_mave#git add -A
root@Ubuntu22Docker:test_mave#git commit -m "update files"
[main ff105aa] update files
10 files changed, 267 insertions(+)
create mode 100755 mave_1.PNG
create mode 100755 mave_2.PNG
create mode 100755 mave_info_dir/mave_info.txt
create mode 100644 nohup.out
create mode 100644 rag_index/default__vector_store.json
create mode 100644 rag_index/docstore.json
create mode 100644 rag_index/graph_store.json
create mode 100644 rag_index/index_store.json
create mode 100644 test_mave_llama.py
create mode 100644 test_mave_openai.py
git add:
변경된 파일을 스테이징 영역(Staging Area)에 추가
이 단계에서는 아직 커밋하지 않고, 변경된 파일을 스테이징 영역에 준비
여기서 스테이징 영역은 커밋할 파일들을 준비하는 임시 영역
git commit -m "Initial commit":
스테이징 영역에 있는 변경 사항을 커밋으로 확정
"Initial commit"이라는 메시지를 커밋에 첨부하여 어떤 변경사항이 있는지 설명
변경사항에 대한 설명과 버전의 스냅샷 생성, 변경사항이 로컬에 영구적으로 기록
이러한 과정을 통해, 작업의 단계별 변경사항을 명확하게 관리 가능
나중에 문제 발생시, 커밋 로그를 통해 어떤 변경사항이 문제를 일으켰는지 파악
git push: local에서 작업한 코드를 GitHub으로 올리는 것
git pull: 반대로 GitHub에서 최신 코드를 local로 가져오는 것
그 전에! push 했더니 아래와 같은 에러 발생
root@Ubuntu22Docker:test_mave#git push origin main
Username for 'https://github.com': xxxxx
Password for 'https://xxxxx@github.com':
To https://github.com/xxxxx/QnA_mave.git
! [rejected] main -> main (fetch first)
error: 레퍼런스를 'https://github.com/xxxxx/QnA_mave.git'에 푸시하는데 실패했습니다
힌트: 리모트에 로컬에 없는 사항이 들어 있으므로 업데이트가
힌트: 거부되었습니다. 이 상황은 보통 또 다른 저장소에서 같은
힌트: 저장소로 푸시할 때 발생합니다. 푸시하기 전에
힌트: ('git pull ...' 등 명령으로) 리모트 변경 사항을 먼저
힌트: 포함해야 합니다.
힌트: 자세한 정보는 'git push --help'의 "Note about fast-forwards' 부분을
힌트: 참고하십시오.
또는
root@Ubuntu22Docker:test_mave#git push origin main
Username for 'https://github.com': xxxxx
Password for 'https://xxxxx@github.com':
To https://github.com/xxxxx/QnA_mave.git
! [rejected] main -> main (non-fast-forward)
error: 레퍼런스를 'https://github.com/xxxxx/QnA_mave.git'에 푸시하는데 실패했습니다
힌트: 현재 브랜치의 끝이 리모트 브랜치보다 뒤에 있으므로 업데이트가
힌트: 거부되었습니다. 푸시하기 전에 ('git pull ...' 등 명령으로) 리모트
힌트: 변경 사항을 포함하십시오.
힌트: 자세한 정보는 'git push --help'의 "Note about fast-forwards' 부분을
힌트: 참고하십시오.
root@Ubuntu22Docker:test_mave#git pull --ff-only origin main
https://github.com/xxxxx/QnA_mave URL에서
* branch main -> FETCH_HEAD
fatal: 정방향이 불가능하므로, 중지합니다.
원격 저장소와 로컬 저장소 사이에 충돌이 발생한 경우에 발생.
주로 다른 개발자가 github에 변경사항 push하고, 그 변경사항이 local에 아직 반영되지 않은 경우에 발생
-> pull로 해결
root@Ubuntu22Docker:test_mave#git pull origin main
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
오브젝트 묶음 푸는 중: 100% (3/3), 769 바이트 | 769.00 KiB/s, 완료.
https://github.com/xxxxx/QnA_mave URL에서
* branch main -> FETCH_HEAD
135f0fa..51a593d main -> origin/main
힌트: You have divergent branches and need to specify how to reconcile them.
힌트: You can do so by running one of the following commands sometime before
힌트: your next pull:
힌트:
힌트: git config pull.rebase false # merge (the default strategy)
힌트: git config pull.rebase true # rebase
힌트: git config pull.ff only # fast-forward only
힌트:
힌트: You can replace "git config" with "git config --global" to set a default
힌트: preference for all repositories. You can also pass --rebase, --no-rebase,
힌트: or --ff-only on the command line to override the configured default per
힌트: invocation.
fatal: Need to specify how to reconcile divergent branches.
그래도 안되면 -> 3가지 방법 있음
Git이 브랜치를 어떻게 합칠지 명시해야 하는 상황
Merge 방식으로 합치기: (기본 옵션)
git pull --no-rebase origin main
Rebase 방식으로 합치기:
git pull --rebase origin main
Fast-forward 방식으로 합치기만 허용:
git pull --ff-only origin main
나는 아래처럼 머지방식으로 해결, 처음것으로 했더니 에러남..
브랜치의 끝이 리모트 브랜치보다 뒤에 있다고 업데이트 거부~
root@Ubuntu22Docker:test_mave#git pull --no-rebase origin main
https://github.com/xxxxx/QnA_mave URL에서
* branch main -> FETCH_HEAD
Merge made by the 'ort' strategy.
README.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Username for 'https://github.com': xxxxx
Password for 'https://xxxxx@github.com':
오브젝트 나열하는 중: 18, 완료.
오브젝트 개수 세는 중: 100% (18/18), 완료.
Delta compression using up to 16 threads
오브젝트 압축하는 중: 100% (14/14), 완료.
오브젝트 쓰는 중: 100% (16/16), 198.94 KiB | 12.43 MiB/s, 완료.
Total 16 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), done.
To https://github.com/xxxxxf/QnA_mave.git
51a593d..716b595 main -> main
아 그리고 push할때 아이디/비번에서 이제 비번 사용안딤
personal access token 으로 비번쳐야 가능함 ㅡㅡ
토큰은 settings -> Developer settings에서 생성 가능
.
.
그럼
.