다른 곳에서 작업하던 소스코드를 옮겨온 후, git commit 이력을 그대로 유지한 채로 다른 repository 로 변경하는 방법이다. 이력까지 옮기려면 당연하게도, 기존에 작업하던 '.git' 폴더가 존재하고 있어야 한다.
기존의 repository remote 제거
git remote remove origin
새로 생성한 repository remote 추가
git remote add origin https://github.com/[github_id]/[repo_name].git
코드 push
예전에는 master가 default branch 였는데 요즘은 main이 default 이다. 하여튼 알맞는 이름을 사용하면 된다.
git push -u origin [branch name]
반응형
'프로그래밍 > git' 카테고리의 다른 글
Git 이용시 password 입력 설정 (매번 입력하기 귀찮을 때..) (1) | 2023.06.13 |
---|---|
Git 인증 실패시 (fatal: Authentication failed for ...) (0) | 2021.09.07 |
GitHub personal access token (0) | 2021.09.07 |