Git 파일 업로드 방법

GitHub에 소스 코드가 들어 있는 폴더 전체를 public repository에 업로드하는 방법입니다.

 

Windows 기준이며, 이미 Git이 설치되어 있다고 가정합니다.

아래 명령어는 Git Bash 에 입력하시면 됩니다.

 

✅ 1. GitHub에서 Public Repository 만들기

  1. GitHub에 로그인
  2. 오른쪽 상단 ➜ + ➜ New repository
  3. Repository name 입력
  4. Public 선택
  5. README, .gitignore 는 체크하지 마세요 (로컬 폴더에 이미 소스가 있으므로)
  6. Create repository 클릭

 

✅ 2. 로컬에서 폴더 연결 및 업로드

▶ 폴더가 아직 Git으로 초기화되지 않았다면:

cd "업로드하려는 폴더 경로"
git init
git remote add origin https://github.com/YourUsername/RepositoryName.git
git add .
git commit -m "Initial commit"
git branch -M main
git push -u origin main

 

 

 

▶ 이미 Git으로 관리되고 있는 폴더라면:

(예: 다른 곳에서 클론한 경우 또는 git init을 한 상태)

cd "해당 폴더 경로"
git remote set-url origin https://github.com/YourUsername/RepositoryName.git
git push -u origin main

 

 

✅ 참고 사항

  • YourUsername은 GitHub 아이디
  • RepositoryName은 만든 repository 이름
  • git add .는 폴더 내의 모든 파일을 추가하는 명령
  • 비밀번호 또는 토큰 입력이 요구될 수 있음

 

 

 

이런 명령어 사용이 번거로우신 분들에게는, GitHub Desktop 이라는 대안이 있습니다.

Git 파일 업로드 / 다운로드 및 버전 관리를 더 편하게 해 주는 앱입니다.

 

https://github.com/apps/desktop?locale=ko-KR

 

GitHub Desktop | Simple collaboration from your desktop

 

github.com