[Giit] Giit config 작업 설명

5870 단어 AWSGittech
자주 잊어버리기 때문에 스스로 필기를 한다

기본 작업(자주 사용됨)

  • add
  • git add .
    
  • commit
  • git commit -m "TestCommit"
    
  • push
  • git push origin HEAD
    
    HEAD를 지정하면 현재 분기
    맥OS는 대소문자head를 구분하지 않기 때문에push가 다른 OS일 경우 다음과 같은 오류가 발생할 가능성이 있다.
    error: src refspec head does not match any
    error: failed to push some refs to 'https://github.com/XXXXXXXXXXX.git'
    
  • fetch
  • git fetch
    
  • pull
  • git pull origin HEAD
    
  • checkkout(분기 전환)
  • git checkout develop
    
  • checkkout(새 지점 만들기)
  • git checkout -b develop
    
    이미 존재하는 경우 오류가 발생합니다.
  • branch 확인
  • git branch -a
    
  • 수여
  • git tag -a v1.0.0 -m 'Tag add.'
    
  • tag push
  • git push origin v1.0.0
    
    GitHub인 경우 메르지를 제작한 후Releases.
  • 확인
  • git show
    

    공통 관계 설정


    전제 조건


    codecommiit 작업을 수행할 수 있는 권한이 있고 AWS 소개가 설정되어 있음(AWS SSO도 OK)

    SSH 버전

  • AWS 콘솔에서 IAM SSH 키를 꺼냅니다.
  • ~/.ssh/config에서 다음과 같이 정의
  • Host git-codecommit.*.amazonaws.com
    User AXXXXXXXXXXXXX001
    
  • Clone
  • git clone ssh://[email protected]/v1/repos/MyDemoRepo my-demo-repo
    
    여러 정의AXXXXXXXXXXXXX001@가 필요하지 않은 곳은 생략할 수 있다

    HTTPS 버전


    공식적으로는 다음과 같이 예상대로 움직이지 않았기 때문에 개인적 총결산이다.
  • AWS 콘솔일 수도 있고 CLI일 수도 있기 때문에 코드commiit의 창고를 제작한다.
  • git 로컬 작업
  • REPONAME=[1で作成したリポジトリ名]
    PROFILE=[AWSプロファイル名]
    REGION=$(aws configure get region --profile ${PROFILE})
    git init ${REPONAME}
    cd ${REPONAME}
    
  • git 초기 설정
  • git config --local credential.helper "\!aws --profile ${PROFILE} codecommit credential-helper \$@"
    git config --local credential.UseHttpPath true
    git remote add origin https://git-codecommit.${REGION}.amazonaws.com/v1/repos/${REPONAME}
    

    슈팅


    fatal: unable to auto-detect email address


    사용자 설정을 하지 않으면 발생fatal: unable to auto-detect email address합니다.
  • 참조
  • 글로벌(전체)
    사용자 설정
  • git config --global user.name "ユーザー名"
    
    메일 설정
    git config --global user.email メールアドレス
    
    확인
    git config -l --global
    
    보충: ~/.gitconfig에 정보가 추가되었습니다.
    利用している環境でユーザが統一できていれば問題ないが、
    特定のリポジトリは認証情報を変えたいという場合はlocalで設定する必要がある。
    
  • local(이 창고만)
  • 사용자 설정
    git config --local user.name "ユーザー名"
    
    메일 설정
    git config --local user.email メールアドレス
    
    확인
    git config -l --local
    
    보충: リポジトリ名/.git/config에 정보가 추가되었습니다.

    좋은 웹페이지 즐겨찾기