카테고리 없음

깃허브 초보, repo생성과 push 익히기

recordmastd 2025. 3. 1. 19:32

repositories  생성 및 레포 초기 설정 (main branch 설정)

1. 상단 바의 repositories 선택 후 new repository 클릭 - 이름 안 겹치게 설정 후 public/private 설정 후 생성

(깃헙 웹페이지 UI 보면 알 수 있는 쉬운 과정)

 

2. main에 추가하고 싶은 프로젝트의 폴더를 선택한 후 git bash를 연다

(그러면 bash에서 경로 설정 따로 안 해도 돼서 편함)

 

3. repo 초기화

git init

 

4. 프로젝트의 모든 파일을 Git에 추가

git add .

 

5. 파일을 추가한 후, 커밋 (커밋메세지는 프로젝트명이 포함 권장)

git commit -m "Initial commit for front project"
// 커밋메세지로 해당 커밋에서 수행된 작업을 설명

 

6. 원격 저장소 설정

git remote add origin https://github.com/username/repository.git
// github 웹페이지에서 복사한 경로

 

7. 커밋을 원격 저장소로 푸시 (기본적으로 main에 push)

git push -u origin master

 

add-commit-push 순서로 진행


새 branch 생성

git checkout -b 브랜치명

 

 

로컬과 연결된 repo 경로 확인

git remote -v
// 위와 같이 연결된 경로가 출력됨
origin  https://github.com/username/reponame.git (fetch)
origin  https://github.com/username/reponam.git (push)