Push專案 by Git Bash
第一次使用GITHUB筆記
1.安裝GITHUB
2.使用GIT BASH 建立SSH連線
3.指令
git init
git add .
git commit –m “init”
git remote add origin git@github.com:username/respository_name
git remote –v (檢查狀態)
git branch --set-upstream-to=origin/master master(第一次push才要輸入)
git pull origin master –allow-unrelated-histories (與現有GITHUB檔案整合)
git push origin master
4.遇到的錯誤
$ git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
$ git push origin master
To github.com:lyan7451/WebProj1
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:lyan7451/WebProj1'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
處理: git remote rm
git add .
重頭來