標籤:
有時候玩github難免會踩坑,記錄一筆流水賬,完整的講述一個項目在geihub上從無到有的過程->
1.github後台建立項目
2.設定項目
3.上傳本地已經存在的項目即需要託管的項目
3.1在終端 cd 到項目所在檔案夾內
3.2 $ git init (初始化一個本地的 git倉庫)
3.3 $ touch README.md (工程代碼的介紹)
3.4 $ git add README.md (添加到倉庫中)
3.5 $ git commit -m “first” (提交備忘)
3.6 $ git remote add origin https://github.com/qxuewei/XWBorderImage (添加本地倉庫origin和指定遠程倉庫地址 連結為剛才建立遠程倉庫的連結)
3.7 $ git pull –rebase origin master (pull 遠程倉庫到本地)
3.8 $ git push origin master (push 本地倉庫到遠程倉庫)
如果出現push到遠程倉庫確不顯示的情況就是本地github帳號沒有配置成功
需要在終端執行:
git config –global user.name “username”
git config –global user.email “[email protected]”
配置你自己的github帳號,尤其是郵箱,不能出錯!
最終你的項目就會成功託管到github上了->
參考連結:
http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to
http://www.techug.com/github-3
http://blog.csdn.net/duxinfeng2010/article/details/8654690
iOS-Github上託管本地項目