본문 바로가기

파이피디아

[깃허브(GitHub) 사용] 깃헙 Repository 생성 및 Desktop에 Clone

전 세계에서 가장 유명한 형상관리 서비스인 GitHub을 이용하기 위한 설정입니다.

 

가장 먼저 저장소(프로젝트)를 생성해서 내 프로젝트를 형상관리 할 수 있습니다.

아래 링크는 GitHub 공식 사이트입니다. 회원가입이 안되있으신 분들은 회원가입 후 이용하시면 됩니다.

 

 

GitHub: Let’s build from here

GitHub is where over 94 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

 

회원가입이 완료되셨다면, 나만의 저장소(프로젝트)를 생성해서 형상관리를 시작해 보겠습니다.

 


 

     # 1. GitHub 회원가입 후 저장소(Repository) 생성하기

그림과 같이 New 버튼을 눌러 저장소를 생성해 줍니다.

저장소 생성 화면

 

     # 2. 저장소(Repository) 설정 및 생성

아래 옵션들을 참고하셔서 저장소를 생성해 줍시다.

 

저장소 설정 화면

 

1) Repository name : 저장소 이름

원하는 이름을 설정하면 됩니다. 나중에 프로젝트가 많아졌을 때를 대비해 이름을 잘 지어주세요.

 

2) Description : 설명

저장소를 설명하는 글입니다. 딱히 넣지 않으셔도 상관 없습니다.

 

3) Public / Private : 저장소 공개 범위

내 프로젝트를 오픈소스로 공개하실 것이라면 Public을 선택하시면 됩니다.

 

대부분은 경우엔 내 프로젝트 소스코드 보호를 위해 Private으로 설정하시면 됩니다.

 

4) ADD a README file : README 파일 생성 여부

클릭하면 내 프로젝트 안에 README 파일을 생성하게 됩니다. 크게 상관은 없지만 그냥 만들어 줍시다!

 

5) Add .gitignore : Git에서 버전관리를 제외할 언어 선택

.gitignore에 언어를 선택하면, 해당 언어관련 설정파일이 실수로 업데이트 되는 것을 방지합니다.

 

예를 들면 PYTHON을 gitignore로 선택하면, 프로젝트 코드를 업데이트 할 때 파이썬 관련 설정파일이 실수로 포함되어도 Git이 업데이트 되는 것을 방지해 줍니다.

 

아래에 보시는 바와 같이 제외되어야 하는 경로, 파일들이 기재되어 있습니다.

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

 

     # 3. 저장소(Repository) 생성 확인

선택한 옵션에 맞춰 저장소가 생성되었는지 확인해 줍시다!

 

저장소 생성 완료 화면

저장소가 성공적으로 생성되었습니다.

 

이제부터 생성된 프로젝트를 진행할 수 있습니다!

 

     # 4. 내 PC에 저장소(Repository) 클론(복사)

이제 본격적인 개발을 위해 내 로컬 PC에 저장소를 복사(클론)해 보겠습니다.

 

4-1) 저장소 URL 복사

아래 화면같이 내 Repository URL을 복사합니다.

내 저장소 Url 복사

 

4-2) Cmder를 통해 복사(git clone) 해오기

잠깐! Cmder가 없으신 분들을 위해 이전에 올린 포스팅 링크 넣어둡니다.

 

 

[터미널] VSCode에 Cmder 설치하고 Linux / Git 명령어 맘껏 쓰자!

# 1. Cmder란?(장점, 사용이유 - Linux / Git) Cmder는 Windows 환경에서 리눅스 명령어(ls 등)을 사용할 수 있게 해주는 콘솔(터미널) 프로그램입니다. Linux 환경이 익숙하신 분들은 Windows 명령어가 생소할

lifedia.tistory.com

 

Cmder에서 git 명령어를 통해 저장소를 클론해 옵니다.

git clone 화면(터미널)

 

아래와 같이 성공적으로 저장소가 복사 되었습니다.

git 완료된 화면(터미널)

 


자 이제 git을 자유롭게 활용하실 준비가 끝났습니다~