소프트웨어/Git

[git] git init 후 저장소로 이용하기

개발자_이훈규 2015. 12. 18. 16:38

2016.07.10 일요일, git init 후 저장소 만들기 정리


git/[upload project name] $ git init --bare

$ cd ../temp

git/temp $ git clone ../[upload project name]

git/temp $ cd [up ~]

git/temp/[up~] $ touch .gitignore

git/temp/[up~] $ git add .gitignore

git/temp/[up~] $ git commit -m "Initial commit"

git/temp/[up~] $ git push origin master



2016.07.10 일요일 이전의 노트들   ---->



1. 라즈베리파이의 어느 폴더에 git init으로 저장소를 만들어줍니다.

2. 그 폴더에서 아래의 명령어를 입력합니다.

git config --bool core.bare true

(http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked)


2. +) git commit -m 'Initial Commit' --allow-empty

git push origin master (초기에 한번만 해주면 그 후엔 git push만 하면 된다.)


3. 아래는 git을 받아보겠습니다.


새로운 폴더에서 아래의 명령어를 치면 클론이 생깁니다.

git clone pi@[address]:[folder path]/.git



4. 16/6/8

bare라는 개념을 알아야 쉽게 해결할 수 있다.


bare는 변경사항만 저장되는 git의 종류이다. 그래서 bare용으로 git을 생성할때는 git init --bare 의 명령어로 생성을 한다.


그런데 git init으로 생성했다면, 위에 나와있는 커맨드로 bare의 기능을 켜줘야한다.



추가로, 원격 저장소에 git init후에 다른 곳에서 commit을 할 경우, 아래와 같이 push를 해야한다.

$ git push origin master


처음에 커밋하면 저장소가 어딘지 알지 못한다.




git config 변경, 최초에 수행할 것들

 git config --global user.name "[이름]"

 git config --global user.email [이메일]

 git config --global core.editor vim

 git config --list


git config 색깔 변경

color.branch=auto

color.diff=auto

color.status=auto


git config list 보기
git config --list


git fetch과정

git fetch

git merge origin/master