Notice
Recent Posts
Recent Comments
Link
«   2025/09   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

뭘 하고 살 것인가

gitlab -> github 잔디 옮겨심기 본문

카테고리 없음

gitlab -> github 잔디 옮겨심기

불먹는파이리 2022. 3. 29. 15:19

깃헙에 잔디 칸에 구멍이 숭숭난 것을 보고 마음이 헛헛해서 이전 회사에서 회사 계정으로 심었던 잔디들이라도 옮겨 심을수 없을까 찾아봤다.

 

우선 깃랩 레포 포크를 뜬 후 깃헙 계정으로 가서 레포 만들기를 누르면 import a repository가 있다.

누르고 싶게 생긴 파란 글씨..눌러보자

 

그럼 이렇게 클론할 레포 주소를 치라고 나온다.

 

포크를 뜬 깃랩 url을 입력해주자.

 

물론 회사 내부 소스코드이기 때문에 프라이빗으로 설정해준다.

 

이렇게 하고 나면 일단 깃헙에 새로운 프라이빗 레포가 생성이 됬지만 잔디는 심어지지 않는다..!

 

회사 레포에서 작업할때의 커밋 이메일과 현재 깃헙 계정의 이메일이 다르기 때문이다.

 

해서 이걸 rebase로 일일이 author mail을 바꿔줘야 하나? 해서 방법을 찾아보니

 

https://stackoverflow.com/questions/66116635/git-rebasing-to-add-an-author-and-email-address-to-many-commits

 

Git rebasing to add an author and email address to many commits

I have been involved in a group project for the period of a month. I thought my commits were submitted in my name using my GitHub related email address and I was getting indications on my main GitHub

stackoverflow.com

 

역시 우리 스택오버플로우는 거의 답이 있다.

 

해서 해당 글을 참조하여

 

git filter-branch --commit-filter '
        if [ "$GIT_AUTHOR_EMAIL" = "//찾아서 바꿀 이메일 주소 입력//" ];
        then
                GIT_AUTHOR_EMAIL="//바꿀 이메일 주소 입력//";
                git commit-tree "$@";
        else
                git commit-tree "$@";
        fi' HEAD

위 명령어로 회사 메일로 내가 커밋한 이력들의 메일을 현재 깃헙 메일로 바꿔주고 포스 푸시를 해주면

 

가뭄이 들었던 잔디칸에 적게나마 잔디들이 돌아올 것이다.

 

private repository의 잔디들을 보여주는 방법은 아래 링크 참조

 

https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/publicizing-or-hiding-your-private-contributions-on-your-profile

 

이상. 메모 끝