복습
• GitHub 에서 Remote 저장소를 생성
• Git Clone 하여 사용할 수 있음.
• Local Repository 에서 Push, Pull (Fetch) 하여 동기화 할 수 있음.
Push : 내 작업을 공유할 때
Pull : 다른 사람의 작업을 가져올 때
git remote add <remote_repo_name> <remote_repo_url>
git remote add origin <remote_repo_url>
계정 정보, 토큰을 넣지 않아서 매번 인증하기 귀찮을 때
git remote set-url <remote_repo_name> <remote_repo_new_url>
git remote set-url origin <remote_repo_new_url>
git remote rename <old_name> <new_name>
origin 같은 저장소 이름 수정
git remote remove <remote_repo_name>
git remote remove origin
git remote -v
토큰 정보를 url에 포함해서 저장한 경우 누구다 열람할 수 있어서
공용 pc 에서는 토큰 정보 등록 X
git remote show <remote_repo_name>
git remote show origin
git pull <remote_repo_name> <branch_name>
git pull origin main
• Remote Repository 의 작업 내용을 Local Repository 에 동기화
• Fetch (download) 와 Merge 의 과정과 비슷
= pull 하면 remote에서 변경된 스냅샷을 local로 가져오는 것
- 만약에 main branch에서 git pull만 했을 때 디폴트로 remote에 있는 main과 연결이 됨.
- 다른 branch에서 pull을 하면 remote에 다른 branch를 가져와서 동기화 해줌.
git push <remote_repo_name> <branch_name>
git push origin main
• Local Repository 에서 작업한 내용을 Remote Repository 에 배포할 때