연습용으로 로컬에 먼저 코딩을 하고,
이후 github.com 에 연동하려고 할 때 작업순서에 대해 기록해 둔다.
스토리를 설명하자면..
- 로컬에 연습용 코드를 먼저 작성했음
D:\workspaces\nodejs\meadowlark - 이후에 github.com 계정에 연동하고자 프로젝트를 생성
https://github.com/maxmin93/node-ex-meadowlark - git 작업용 로컬 계정 정보를 입력함 : email과 name 둘다 넣어야 함
git config –global user.email
git config –global user.name - ‘git init’를 실행해 로컬 저장소로 인식시키고
- 리모트 저장소를 연결시킨다
git remote add origin https://github.com/maxmin93/node-ex-meadowlark - 일반적인 작업 순서대로 add 이후 commit을 시도했으나 에러 발생
– 검색해 보니 리모트 작업공간과 초기상태가 같지 않아 발생
– git pull 을 실행해야 한다고 함 - git pull 을 실행했으나 tracking 정보가 없어 metge 해야 한다고 함
– 검색해 보니 강제적인 옵션 ‘–allow-unrelated-histories’ 가 필요함 - 옵션을 붙여 로컬 orgin과 리모트 master를 강제적으로 동기화 시킴
– git pull origin master –allow-unrelated-histories - git 상태를 체크해 보니 깨끗해서 push를 시도했더니 성공!
이와 같은 스토리로 진행됨. 아래는 히스토리
> git config --global user.email "maxmin93@gmail.com" > git config --global user.name "tonyne.jeju" > git init Initialized empty Git repository in D:/workspaces/nodejs/meadowlark/.git/ > git remote add origin https://github.com/maxmin93/node-ex-meadowlark > git add -A warning: LF will be replaced by CRLF in package.json. The file will have its original line endings in your working directory. > git commit -m "Initial commit" [master (root-commit) 0d67098] Initial commit 11 files changed, 84 insertions(+) create mode 100644 .gitignore create mode 100644 meadowlark.js create mode 100644 package.json create mode 100644 public/img/favicon.ico create mode 100644 public/img/logo.png create mode 100644 public/img/pic_mountain.jpg create mode 100644 views/404.handlebars create mode 100644 views/500.handlebars create mode 100644 views/about.handlebars create mode 100644 views/home.handlebars create mode 100644 views/layouts/main.handlebars > git push origin master To https://github.com/maxmin93/node-ex-meadowlark ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/maxmin93/node-ex-meadowlark' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. > git pull warning: no common commits remote: Counting objects: 3, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/maxmin93/node-ex-meadowlark * [new branch] master -> origin/master There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> master > git pull https://github.com/maxmin93/node-ex-meadowlark master From https://github.com/maxmin93/node-ex-meadowlark * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories > git pull origin master --allow-unrelated-histories From https://github.com/maxmin93/node-ex-meadowlark * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md > ll D 드라이브의 볼륨: data 볼륨 일련 번호: 9A0E-CB62 D:\workspaces\nodejs\meadowlark 디렉터리 2017-01-22 오후 07:00 <DIR> . 2017-01-22 오후 07:00 <DIR> .. 2017-01-22 오후 06:40 79 .gitignore 2017-01-22 오후 02:54 1,266 meadowlark.js 2017-01-22 오후 03:03 <DIR> node_modules 2017-01-22 오후 03:03 309 package.json 2017-01-22 오후 02:12 <DIR> public 2017-01-22 오후 07:00 87 README.md 2017-01-22 오후 01:30 <DIR> site 2017-01-22 오후 02:40 <DIR> views 4개 파일 1,741 바이트 6개 디렉터리 946,902,597,632 바이트 남음 > git status On branch master nothing to commit, working tree clean > git push origin master Counting objects: 19, done. Delta compression using up to 4 threads. Compressing objects: 100% (14/14), done. Writing objects: 100% (19/19), 243.81 KiB | 0 bytes/s, done. Total 19 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), done. To https://github.com/maxmin93/node-ex-meadowlark 93fec6e..dc78c6f master -> master > _