一、(先進入項目文件夾)經過命令 git init 把這個目錄變成git能夠管理的倉庫html
git init
二、把文件添加到版本庫中,使用命令 git add .添加到暫存區裏面去,不要忘記後面的小數點「.」,意爲添加文件夾下的全部文件git
git add .
三、用命令 git commit告訴Git,把文件提交到倉庫。引號內爲提交說明github
git commit -m 'first commit'
四、關聯到遠程庫code
git remote add origin 你的遠程庫地址
如:htm
git remote add origin https://github.com/githubusername/demo.git
五、獲取遠程庫與本地同步合併(若是遠程庫不爲空必須作這一步,不然後面的提交會失敗)blog
git pull --rebase origin master
六、把本地庫的內容推送到遠程,使用 git push命令,其實是把當前分支master推送到遠程。執行此命令後會要求輸入用戶名、密碼,驗證經過後即開始上傳。rem
git push -u origin master
*、狀態查詢命令同步
git status
備:詳細請參考 http://www.cnblogs.com/tugenhua0707/p/4050072.htmlit