내 repository가 아닌 곳에 commit 할 때 잔디 심는 방법

yeji·2022년 3월 22일
0

깃허브에 잔디를 심을 수 있는 기준

  1. GitHub 계정과 commit 이메일 계정이 동일해야 한다.
  2. Fork한 repository가 아닌 내 repository에서 commit해야 한다.

이러한 기준 때문에 아래와 같은 케이스에서는 잔디가 심기지 않는다.

  • Organization branch에 commit 할 때
  • fork하여 내 repository로 가져와 commit -> 이 경우 Pull Request하는 경우에만 잔디가 심긴다.

해결 방법

fork 대신 이전에 commit을 했던 기록도 함께 복사하는 방법을 사용해야 한다.

1. bare clone / mirror-push

  1. 내 github에서 새 repository를 생성한다. (new-repo)
  2. 프로젝트들이 위치한 곳에서 terminal을 연다.
  3. 복사하고자 하는 원본 repository를 bare clone한다.
    $ git clone --bare https://github.com/exampleuser/origin-repo.git
  4. 새로운 repository로 Mirror-push
    $ cd origin-repo.git
    $ git push --mirror https://github.com/exampleuser/new-repo.git
  5. 처음에 임시로 생성했던 local repository를 삭제
    $ cd ..
    $ rm -rf new-repo.git
    참고 링크: https://soranhan.tistory.com/11

2. 두 개의 repository를 모두 remote로 연결

  1. 원래의 repository를 클론한 local에서 새 repository를 파고
  2. 원래와 새 repository, 두 개의 remote 연결하고 두 곳에 푸시
    더 직관적으로 두 repository의 상태 확인 가능한 방법
profile
🐥

0개의 댓글