-
Git 새로운 remote repository 추가CS/git 2022. 6. 27. 11:26
1. 기존 repository 정리
- 다른 branch들 삭제 및 pull & push
$ git branch -d develop2 $ git pull origin master $ git add . $ git status $ git commit -m "clean push" $ git push origin master
2. 기존 repository 삭제
$ git remote remove origin $ git remote -v
3. 원하는 directory 로 이동
$ cd {MY_DIR}
4. git init으로 초기화
$ git init Reinitialized existing Git repository in {MY_DIR} .git/
5. 새로운 repository 연결
$ git remote add jenkins https://{MY_GIT}.git $ git remote -v jenkins https://{MY_GIT}.git (fetch) jenkins https://{MY_GIT}.git (push)
6. git pull로 기존 repo 따오기
$ git pull {MY_REMOTE_REPO} {branch}
6. 원하는 파일만 추가
$ git add data/user/ $ git status $ git commit -m "feather test" $ git push jenkins2 master
Reference:
https://gist.github.com/480/4681b67d2a906db8c6c1321cc678f05f
'CS > git' 카테고리의 다른 글
git pull remote branch (0) 2023.04.17 git clone 특정 branch (0) 2022.12.18 M1 chip github 설치 (0) 2022.12.18 디렉토리 변경할때마다 git 초기화 필요 (0) 2022.07.07 [jenkins] git API key로 crendential 추가 (0) 2022.07.05