提交代碼到gitbub.com
touch README.md //新建說明文件
git init //在當前項目目錄中生成本地git管理,並建立一個隱藏.git目錄
git add . //添加當前目錄中的所有文件到索引
git commit -m "first commit" //提交到本地源碼庫,並附加提交註釋
git remote add origin https://github.com/chape/test.git //添加到遠程項目,別名爲origin
git push -u origin master //把本地源碼庫push到github 別名爲origin的遠程項目中,確認提交
如果本地項目提交到gitbub提示 fatal: refusing to merge unrelated histories
可以執行如下代碼,然後再提交
git pull origin master --allow-unrelated-histories