1. 리포지토리 생성
아래 사이트로 이동후 로그인합니다.
GitHub: Where the world builds software
GitHub is where over 65 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...
github.com
New repository를 클릭합니다.
Repository name을 작성하고 Create repository를 클릭합니다.
repository가 생성되었습니다.
2. git 저장소 초기화
저장소로 이용할 폴더를 생성합니다.
새로 만든 폴더로 이동후 git bash를 실행합니다.
다음 명령어를 입력합니다.
$ git init
명령어를 입력하면 저장소가 초기화되고 아래 명령어를 입력하면. git라는 폴더가 생성된 것을 확인할 수 있습니다.
$ ls -al
3. repository(원격 저장소) 연동
git init로 깃 저장소를 초기화했으면 원격저장소와 연동할 수 있습니다.
remote라는 명령어를 이용해서 원격 저장소와 연동할 수 있습니다.
$ git remote add <원격 저장소 별명> <원격 저장소 url>
github로 이동해서 원격 저장소 url을 복사합니다.
아래 명령어를 입력합니다.
$ git remote add origin https://github.com/jun0925/git-repo.git
리모트 정보를 볼 수 있는 명령어 입니다.
$ git remote -v
잘 연결된 것을 확인할 수 있습니다.
4. repository(원격 저장소)에 파일 업로드하기
work.txt 파일을 생성합니다.
add명령어를 사용해서 버전 관리에 등록합니다.
$ git add work.txt
commit 명령어를 이용해서 버전을 생성합니다.
$ git commit -m "work 1"
push 명령어를 이용해서 원격 저장소에 commit 내용을 반영합니다.
$ git push <원격 저장소 별명> <브랜치 이름>
$ git push origin master
정상적으로 업로드되었습니다.