어쩌다 알게 된 ƪ(•̃͡•̃͡ ƪ

🐾 [Git] git clone, git pull 다른 컴퓨터에서 작업하기 본문

git, github

🐾 [Git] git clone, git pull 다른 컴퓨터에서 작업하기

비니_ 2025. 3. 22. 22:38
728x90
명령어 설명
git init 새 폴더에서 Git을 초기화
git remote add origin 깃주소 저장소 연결하기
git pull 최신 상태로 받기
git checkout -b 브랜치명

=> git checkout -b dev
새로운 브랜치 생성 후 이동
테스트 파일 만들고
git status
변경된거 있는지 확인
git add . 추가
git commit -m"메세지입력" 커밋 주석
git push --set-upstream origin dev 푸시할 때는 원격 저장소와의 연결을 설정
=> 이때 깃허브 로그인창 떠서 연결하면 끝

 

완료~

 

 

git pull 오류 👇

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=<remote>/<branch> master

 

=> 지금 있는 브랜치가 원격(remote) 브랜치랑 연결되어 있지 않아서 어디서 pull 해올지 모르겠다는 뜻

 

해결방법

명령어 설명
git remote add origin 깃주소 원격 저장소 연결
git fetch origin 원격 브랜치 가져오기 (clone 안 했으니까)
git fetch origin 원격 브랜치 확인

=> 여기서 origin/main 같은 형태가 나오면 성공
git checkout -b main origin/main

=> git checkout -b [내_브랜치이름] [원격/브랜치이름]
원격 main 브랜치로 체크아웃 (원격 main  브런치 만들어서 전환)
git pull 최신 상태로 땡겨오기
git config --local user.email git 이메일 설정 되어있는지 확인 (해당 프로젝트에서만)
=> 아무것도 안나오면 안되어 있는거
git config --local user.email "your-email@example.com" 이메일 설정 (해당 프로젝트에서만)

모든 프로젝트에서는 --global
git config --global --list git 모든 설정 보여주는 명령어

 

728x90
Comments