Workspace & Develop/Git

GIT) 최초 원격 저장소(repo) 설정 및 Push

소소한 늙은 개발자의 메모장 2026. 8. 20. 14:37
반응형

GIT 최초 원격 저장소(repo) 설정 및 Push

  • git 초기 설정
cd existing_repo
git init
git remote add origin http://git.xxx/xxx/~~~.git
git branch -M main
  • 파일 추가
git add .
  • 윈도우 줄바꿈 자동 변환 기능 (옵션)
    • 전역 : git config --global core.safecrlf false
    • 현재 Repo만
      • 환경등록 : git config core.safecrlf false
      • 고정 관리 (.gitattributes)
# .gitattributes 내용 수정 ---------------------------------------------------
# 모든 텍스트 파일은 Git 저장소에는 LF로, Windows 체크아웃 시 CRLF로 자동 정규화
* text=auto

# 소스 코드 파일은 항상 LF로 통일하고 싶을 때
*.cs text eol=lf
*.xml text eol=lf
*.json text eol=lf

# 바이너리 파일은 변환 제외
*.png binary
*.dll binary
*.exe binary
# ---------------------------------------------------------------------------
  • 최초 커밋
git commit -m "Initial commit"
  • 원격 저장소로 PUSH
git push -uf origin main

 

반응형