[Project] 플레이데이터 장고 미니프로젝트 - git hub 초기 세팅

싱숭생숭어·2023년 5월 12일
0

project

목록 보기
1/5

장고 미니프로젝트

주제: 장고를 활용해서 서버로 웹페이지 구현하기

장고 파일의 세부사항을 수정하기 전에 앞서, 우리조는 협업을 위한 배경이 되는 깃 허브를 연결해 작업하기로 했음. 아래는 VSCODE의 터미널에서 git을 연결하고 main branch를 만들고 나의 girt hub에 파일을 업로드하는 총체적인 과정에 대해 정리할 것 !

git hub 초기 세팅

1) 구글에 깃 허브 검색
2) 깃허브 들어가서 본인 회원가입 및 계정 생성
3) 나의 깃허브 페이지 들어가기

4) 왼쪽 위에 Repositories New <- 클릭해서 레포지토리 새로 생성

5) Repositoriy name <- 이 부분만 추가해서 나의 레포지토리 생성


6) 깃허브 레포지토리 주소를 알려주고, setting에 Manage Access 부분에 Add people 눌러서 같이 작업할 사람들의 깃허브 아이디 추가

7) 장고 파일을 open한 VSCODE안에서 터미널 열기

8) 터미널에 git clone + 나의 git 레포지토리 주소를 입력하면 다음과 같은 에러가 뜬다.
git@github.com: Permission denied (publickey) -> 나의 pubilckey가 깃허브에 등록되어있지 않다는 에러 ! 따라서 내 컴퓨터의 pubilckey를 찾아서 git hub 페이지에 등록해줘야함

9) 터미널 창에서 cd ~ + cd .ssh + ssh-keygen -t rsa -> 나의 키를 발급받기

10) cat id_rsa.pub 명령어를 입력해서 나오는 나의 public key를 복사

11) 나의 깃허브 페이지의 settings를 누르고, 좌측 네비게이션 바에서 SSH and GPG keys 선택

12) New SSH key 클릭 -> KEY 부분에 SSH 키 붙여넣기

13) home에 test라는 폴더 생성 후, 다시 한번 깃 주소로 git clone

-> 그럼 이제 test라는 디렉터리 안에 나의 git hub 레포지토리 이름인 playdata-django 폴더가 생성된 것을 볼 수 있음

14)

  • git remote -v는 현재 git에 연결되어있는지 확인하는 작업
  • echo "hi" >> encore.txt -> hi라는 내용의 encore.txt 파일을 생성
  • git add . -> 현재 수정사항을 모두 반영해 brangh에 추가
  • git commit -m "first" -> first란 이름으로 commit 을 하겠다(현재 branch에서 지금까지 한 것을 저장하겠다)

그럼 이제 나의 이메일과 이름을 git config global--을 통해 저장하라는 문구가 뜬다

15) 위의 문구를 활용해서 나의 이메일과 이름을 지정해준다.

지정해주고 다시 git commit을 하니, 제대로 commit이 된 것을 볼 수 있다.

그 다음 나의 로컬 branch에 저장한 것을 master라는 git hub의 메인 branch에 올려주려고 하니, error: failed to push some refs to 'github.com:2hey9/playdata-django.git'이런 에러가 발생 -> 나의 git hub에 메인 branch가 있지 않아 발생하는 오류 !

16)

  • git branch -M main + git push -u origin main
    나의 git hub에 main branch를 생성해준다.

17)

  • 현재 team_django/team1 폴더 안에 우리 팀의 장고 파일이 존재하므로, 이 안에 있는 모든 내용을 cp -r * ~/test/playdata-django/ 명령어를 통해 복사 !

    • cp: 파일 또는 디렉토리를 복사하는 명령어입니다.
    • -r: 재귀적으로 디렉토리와 그 내용을 복사하는 옵션입니다.
    • *: 현재 디렉토리의 모든 파일과 디렉토리를 의미합니다. 와일드카드 문자로 사용되어 현재 디렉토리의 모든 항목을 선택합니다.
    • ~/test/playdata-django/: 복사 대상 디렉토리의 경로입니다. ~은 홈 디렉토리를 나타내고, test/playdata-django/는 해당 디렉토리의 상대 경로입니다. 현재 디렉토리의 모든 파일과 디렉토리를 ~/test/playdata-django/ 디렉토리로 복사합니다.
  • 그 후 다시 cd ~/test/playdata-django/를 통해 test/playdata-django 디렉터리로 들어가서, git add . + git commit -m 으로 다시 한번 commit !

18)

  • git push origin main를 통해 main branch에 현재 commit된 내용 push !

  • 만약 현재까지 commit된 내용을 확인하고 싶다면 git status 명령어 입력 !

19)

그럼 이제 나의 깃허브 레포지토리에 장고 파일들이 올라와있는 걸 확인할 수 있다 !

끝 !!

++ 찐막 git hub에 올릴때 .gitignore 파일을 올려놔야함

<<<<<<< HEAD
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
=======
<<<<<<< HEAD
# Created by https://www.toptal.com/developers/gitignore/api/django
# Edit at https://www.toptal.com/developers/gitignore?templates=django
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
pybo/__pycache__/
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/
### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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/
cover/
# Translations
*.mo
# Django stuff:
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .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
# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# End of https://www.toptal.com/developers/gitignore/api/django
=======
# Created by https://www.toptal.com/developers/gitignore/api/django
# Edit at https://www.toptal.com/developers/gitignore?templates=django
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
pybo/__pycache__/
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/
### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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/
cover/
# Translations
*.mo
# Django stuff:
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .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
# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# End of https://www.toptal.com/developers/gitignore/api/django
.DS_Store
>>>>>>> 5678100066b68c435f637542676632b111c0c452
>>>>>>> bb040a2dd3558d8c4a0bfaaeda1213fdb93b2fc2

이거 복붙해서 장고 프로젝트 manage.py가 위치한 디렉터리 내에 .gitignore파일 만들고, 내 git hub에 push 해놓기 !!

profile
공부합시당

0개의 댓글