본문 바로가기

Git

git 초기 설정

반응형

 

1. git repository를 생성하고자 하는 디렉토리에서 git init 명령이 입력

$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in
 

2. 프로젝트의 현재 git 상태 확인

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        SunnyBlog/
        db.sqlite3
        manage.py

nothing added to commit but untracked files present (use "git add" to track)
 

3. Repository에 생성 된 git file 추가하기

$ git add .
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   SunnyBlog/__init__.py
        new file:   SunnyBlog/__pycache__/__init__.cpython-38.pyc
        new file:   SunnyBlog/__pycache__/settings.cpython-38.pyc
        new file:   SunnyBlog/__pycache__/urls.cpython-38.pyc
        new file:   SunnyBlog/__pycache__/wsgi.cpython-38.pyc
        new file:   SunnyBlog/asgi.py
        new file:   SunnyBlog/settings.py
        new file:   SunnyBlog/urls.py
        new file:   SunnyBlog/wsgi.py
        new file:   db.sqlite3
        new file:   manage.py
 

4. git commit 하기

git commit -m 'init'
[master (root-commit) 15984bc] init
 11 files changed, 195 insertions(+)
 create mode 100644 SunnyBlog/__init__.py
 create mode 100644 SunnyBlog/__pycache__/__init__.cpython-38.pyc
 create mode 100644 SunnyBlog/__pycache__/settings.cpython-38.pyc
 create mode 100644 SunnyBlog/__pycache__/urls.cpython-38.pyc
 create mode 100644 SunnyBlog/__pycache__/wsgi.cpython-38.pyc
 create mode 100644 SunnyBlog/asgi.py
 create mode 100644 SunnyBlog/settings.py
 create mode 100644 SunnyBlog/urls.py
 create mode 100644 SunnyBlog/wsgi.py
 create mode 100644 db.sqlite3
 create mode 100755 manage.py
 

5. github 연결 설정 및 push

$ git remote add origin git@github.com:vioiv/SunnyBlog.git

$ git push -u origin master
Enumerating objects: 14, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 12 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (14/14), 4.87 KiB | 1.62 MiB/s, done.
Total 14 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), done.
remote: 
remote: Create a pull request for 'master' on GitHub by visiting:
remote:      https://github.com/vioiv/SunnyBlog/pull/new/master
remote: 
To github.com:vioiv/SunnyBlog.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
 

 

 

반응형