GIT

Github push, pull, clone

Eco 2022. 1. 13. 16:20

github에 push, pull, clone을 해봅시다.

더보기

gitHub이란 분산서버 관리가 가능한 클라우드 저장소 입니다.

> github에 myApp repository 생성

> ex_compay, ex_home 폴더를 생성 -> 각 폴더에 myApp(github repository와 같은 이름) 생성

git push

  1. git init 
    github을 부르는 키워드 -> origin
  2. git remote add origin [github repository address]
    git remote -v (git ls-remote 도 같은 의미로 사용 가능)
    연결된 곳을 확인 할 수있다
  3. git add, commit
    파일을 만들고 commit 하여야 한다 > touch ProjectConfigComplete.txt > add, commit
  4. git push origin master
    local 에 있는 자료를 github 으로 올려야한다 파일 업로드와 함께 github에 맞게 merge도 되어한다 -> push
    github 의 주소가 연결이 되어 있으면 자동으로 github에 올라간다
    (github이 저장이 안되어 있을경우 아이디 패스워드를 쳐야한다)

git pull

> ex_home → myApp

  1. git init
  2. git remote add origin [github repository address]
    github 에 생성이 되어있는 repository 주소를 붙인 후 git ls-remote 또는 git remote -v 로 확인가능
    git log로 받아온 데이터들을 확인 가능

git clone

git clone의 경우 init, remote, pull 다 합쳐진 명령어 이다 -> ex_home 의 myApp 을 지우고 ex_home에서 

git clone [github repository address]

위의 명령어를 사용하면 ex_home에 myApp github repository가 복사된다.