利用Git從本地上傳到GitHub
阿新 • • 發佈:2018-12-04
執行“利用Git從本地上傳到GitHub”文件流程之前,確定在執行過搭建Git和GitHub環境
git遠端操作流程圖:
建立本地倉庫
進入要所要上傳檔案的目錄右鍵開啟Git Bash
執行指令: “git init”
新增關聯的遠端庫
執行指令:git remote add origin https://github.com/yourName/yourRepo.git
yourname是你的GitHub的使用者名稱,yourRepo是你要上傳到GitHub的倉庫。
將所有檔案新增到本地index庫
如果你要新增一個檔案xxx到本地倉庫,使用命令 “git add xxx”
,可以使用“git add
.”自動判斷新增哪些檔案。
index庫新增到本地倉庫
執行指令:
”git commit -m ”說明這次的提交“
把本地倉庫提交到遠端的GitHub倉庫
如果時是第一次提交,執行 執行指令:
git push -f origin master
如果不是第一次提交 執行指令:
git push -u origin master
參考文件: Git遠端操作詳解如果執行‘git push -u origin master’,報
“fatal: protocol ‘[email protected]:libaoshan55/https’ is not supported”的錯誤,刪除與遠端庫的關聯,
執行命令git remote remove origin
重新新增關聯的遠端庫,再執行提交
Git和GitHub使用方法總結
上傳本地檔案到github