⚠️ IntelliJ에서 프로젝트를 생성하고 git에 연동하려는데 예전에 쓰던 계정에 게속 연동되는 문제 발생

    ⚠️ IntelliJ에 연결된 예전 계정 삭제하고 새 계정만 연결해서 다시 업로드했더니 새 깃허브에 예전 계정으로 업로드됨

     

     

    ‼️해결 방법

     

    1. 먼저 현재 연결된 계정 확인하기

    git config user.name

     

     

    2. 계정 변경해주기

    git config --global user.name 새로연결할계정이름
    git config --global user.email 새로연결할계정이메일

     

    3. git config user.name 으로 계정 변경 확인

     

     

    Git repository 삭제하기

     

    1. github 사이트에서 repository 삭제해주기

    2. IntelliJ 프로젝트 폴더 내에서 rm -rf .git 로 .git 파일 삭제

    3. IntelliJ에서 Preferences > Directory Mappings 에서 VCS -> <none> 으로 변경 or 연결된 Directory 자체를 삭제

    하나의 Repository에 여러 개의 프로젝트 업로드

     

    Spring 공부하면서 프로젝트 하나 만들 때마다 업로드되면 너무 쓸데없이 많아지고 지저분해질 것 같아서

    하나의 Repository에 여러 프로젝트를 생성하려고 이렇게 저렇게 시도해봤는데,,

    자꾸 Reject 뜨면서 절대 안되고, 계속 생성하고 지우고 반복하다가 찾아보니까

    subtree를 이용하는 방법이 있길래 정리해보려고 합니다!

     

    1. GitHub에 하나의 빈 Repository 생성
      • 여러 프로젝트를 담을 부모 Repository 가 됨
    2. 부모 Repository clone
      • GitHub Code 에서 주소 Copy 
      • Terminal에서 clone
        git clone 부모Repository주소
    3. 부모 Repository로 이동
      cd 부모Repository이름
    4. subtree 이용해 부모 Repository에 자식 Repository 넣기
      git subtree add --prefix=폴더명 자식Repository주소 branch이름
      • 폴더명은 부모 Repository에서 보여질 폴더명
      • 자식Repository주소는 GitHub 주소를 뜻하기에 이미 GitHub에 자식 Repository가 존재해야 함
      • ⚠️이때 부모 Repository 아무 commit이 없는 경우 오류 발생
        더보기
        ambiguous argument 'HEAD': unknown revision or path not in the working tree
        • commit 메시지 생성
      • git commit --allow-empty -n -m "커밋메시지"
    5. GitHub에 push
    6. git push origin main
      • ⚠️로그인 과정에서 오류 발생
        더보기
        remote: Support for password authentication was removed on August 13, 2021. remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
        • GitHub에서 Settings >  Devloper setteings > Personal acces tokens > Tokens (classic) 클릭 후 Token 생성
          • repo
          • admin:repo_hook
          • gist
          • user
          • delete_repo
        • 생성된 Token 복사
        • Teminal에서 다시 push 한 후, password 입력란에 복사한 Token 입력!
    7. 부모 Repository에 자식 Repository 파일 형식으로 생성 완료
      • 정상적으로 업로드가 완료되었으면, 기존 자식 Repository는 삭제해도 됨
    8. 이후에는 자식 Repository 넣는 부분만 해주면 됨(부모 Repository 생성 없이)

     

    git remote set-url origin https://발급받은토큰@github.com/username/repository이름.git

     

    <참고 링크>

    https://hy-ung.tistory.com/86

     

    [Git hub] 하나의 Repository에 여러 프로젝트 올리기

    한개의 레포지토리에 여러 프로젝트를 생성하여 프로젝트를 진행 하고자 했다. 인텔리제이에서는 한개의 프로젝트에서 여러 프로젝트가 생성이 되었지만, 이것을 깃허브에 Push 하는 과정에서

    hy-ung.tistory.com

    https://velog.io/@049494/하나의-리포지토리에-여러-프로젝트-올리기

     

    # 하나의 레포지토리에 여러 프로젝트 올리기

    과제를 여러개 올리는 경우, 각각 리포지토리를 만들면 너무 갯수가 많아지므로 하나의 리포지토리에서 여러 프로젝트를 관리해야할 필요성이 생긴다. 👉🏻 리포지토리 안에 여러 폴더를 만

    velog.io

    https://hyeo-noo.tistory.com/184

     

    [Mac] GitHub push token 오류 해결

    Github 오류 7.29일 새벽 갑자기 git push가 안 되는 현상을 겪었다. 오류의 첫 줄이 무슨 말이냐면 Password 인증방식이 일시적으로 brownout(shutdown?)되었다. Password 대신에 personal access token을 사용해주세

    hyeo-noo.tistory.com

     

    + Recent posts