git上傳本地檔案到GitHub並更新

2021-09-13 14:38:48 字數 919 閱讀 5099

前提:已經安裝了git並且有github賬號,在github賬號上建立了倉庫

首先開啟需上傳檔案的下一級目錄,比如我上傳的是test檔案,我需進入test資料夾中,右鍵選擇git bash here,進入git命令介面,比如我的git使用者名稱是chen,郵箱是[email protected]

第一次上傳需要git init 初始化

git config user.name "chen"         

git config user.emia "[email protected]"

git add .                                    將檔案加入git緩衝中

git remote add origin           倉庫的位址

git push -u origin master                    提交

這裡會報錯,可以採用強制提交

git push -u origin master  -f      強制提交

更新檔案

git add . 

git status git commit -m "更新"

git 上傳本地檔案到github

git 上傳本地檔案到github 1 git config global user.name your real name 2 git config global user.email you email.address git init git add git commit m test git...

git 上傳本地檔案到github

git 上傳本地檔案到github 1 git config global user.name your real name 2 git config global user.email you email.address git init git add git commit m test git...

git上傳本地檔案到GitHub

檢視分支 git branch 新建分支 git checkout b 切換分支 gitcheckout git刪除遠端倉庫檔案 1 在本地拉取分支 git pull origin hukongtao 你想操作的分支 2 在本地刪除對應的檔案 git rm filename 同時在快取和物理儲存中刪...