Translational Healthcare/Github

[Github] #4 Local to Remote repository (Push & Pull)

developing 2022. 7. 13. 16:09

 

 

Git(Local repository)에서의 기본 branch: “master”

Remote repository의 기본 branch: “origin“

Local repository → Remote repository: “push”

Remote repository → Local repository: “pull”

 

 

Git commands Explanation
git remote add origin copied link Local repository와 remote repository 연결
copied link는 자신의 github 계정에서 새 repository 생성하고 HTTPS 링크 복사 ex. https://github.com/kyeonglim/test1.git
git remote –v Local repository과 remote repository 연결 확인
git push –u origin master origin branch (Local repository)을 master branch (Remote repository)로 push (–u는 처음에만)
git push 위처럼 연결하고 한번이라도 push 했으면 다시 push할 때에는 간략히 입력
git pull origin master Remote repository 내용을 Local repository로 가져옴
(git pull만 입력 가능)