Git

깃 bash 사용하기

낮햇볕 2022. 2. 14. 21:37

간단히 적어본다 

깃설치

 

일단 깃허브에 repository 만들기

 

커밋 해줄 곳에 마우스 오른쪽을 클릭하면 giy Bash Here 누르기

 

 창나옴 

 

git log

 

git add .

 

git commit -m '커밋이름'

처음하면 너가누구냐고 해서 지정이 안됨

                     

$ git config --global user.name "이름"  
$ git config --global user.email "이메일" 

 그럼 이메일 이름 적어줘야함

 

git commit -m '커밋이름'         

다적어주고 이거 적으면됨

 

git log   

들어갔는지 확인

 

git add .

만약 다른것도 추가 하고싶다면 추가하고싶지 않다면 바로 repository주소입력하면된다

 

git commit -m '커밋이름'  

 

git log 들어갔는지 확인

git remote add origin https://repository 주소입력     

repository를 만들고나면 바로 밑에가면…or create a new repository on the command line라도 적혀있는데 거기서 맨밑에서 두번째꺼 를 입력하면된다

 

 git push -u origin master  

이것도 repository만들고 스크롤내리면 …or create a new repository on the command line 나오는데 거기서 맨밑꺼 적으면된다 원래 거긴 끝에가 main이라 적혀있는데 git bash에는 branch가 master라 적혀있어서 master라 적어야 커밋된다

 

아그리고 위에거 다하면 처음하면 로그인하라고 나온다 로그인하고 보면 커밋이되어져있다

 

//pull 로 하고싶다면 다시

 

git init

 

git  pull https의 주소

repository에 코드누르면 https의 주소나오는데 그걸적으면된다

 

git log

 

git add . 

pull 추가하기위해 파일만들어지 거기 안에 위에 커밋한거다나옴

 

git commit  -m 'pull커밋이름'

 

git log

pull 추가 되었는지 보기

 

git remote add origin https://repository 주소입력   

repository를 만들고나면 바로 밑에가면…or create a new repository on the command line라도 적혀있는데 거기서 맨밑에서 두번째꺼 를 입력하면된다

 

 

 git push -u origin master 

이것도 repository만들고 스크롤내리면 …or push an existing repository from the command line 나오는데 거기서 맨밑꺼 적으면된다 원래 거긴 끝에가 main이라 적혀있는데 git bash에는 master라 적혀있어서 master라 적어야 커밋된다

 

그럼 pull도 커밋됨