Git Repository(저장소) 변경하기
깃허브 저장소 변경하기 (GitHub Repository Change)
- 주소를 기존 주소 : repo1.git과 새로운 주소 : repo2.git이라고 가정하고 설명하겠습니다.
- 현재 연결된 주소를 확인합니다.
git remote -v-
origin repo1.git (fetch) origin repo1.git (push) 이런 결과가 나올겁니다.
-
- 새로운 url 셋팅하기
remote set-url-
git remote set-url origin repo1.git git remote set-url origin repo2.git
-
- 새로운 Repository에 Commit하기
-
git init # 현재 디렉토리에 깃 저장소 생성 git add . # 변경 사항이 있는 파일 Staging에 올리기 .은 전체 파일을 가리킵니다. 파일을 정해서 올리고 싶다면 파일명을 적어주시면 됩니다. git commit -m "first commit" # 커밋 메세지 git branch -M main // main 브렌치 생성 git remote add origin 깃주소 # 깃 주소를 origin으로 사용할 수 있게 해줍니다. git push -u origin main # 내가 만든 main 브랜치에 commit한 파일을 올립니다.
-
특정 브랜치 Clone하기
-
git clone --branch 브랜치명 깃주소