1、登陸GitHub建立倉庫 ,步驟以下:git
一、點擊新建github
二、填寫倉庫名稱等編輯器
三、建立完成ide
2、關聯已有的本地項目(沒有須要關聯的本地項目,能夠直接從剛剛建立的GitHub倉庫clone)this
一、到本地項目文件夾下用git命令行依次輸入下面的兩條命令spa
git init
git remote add origin https://github.com/zhi-nian/VuePractice.git
執行結果以下:
PS E:\code> git init Initialized empty Git repository in E:/code/.git/ PS E:\code> git remote add origin https://github.com/zhi-nian/VuePractice.git
3、上傳本身的本地代碼命令行
一、編輯器報錯3d
二、解決辦法code
切換到項目所在目錄,在命令行窗口依次輸入orm
git pull
git pull origin master
git pull origin master --allow-unrelated-histories
執行結果以下:
PS E:\code> git pull warning: no common commits remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/zhi-nian/VuePractice * [new branch] master -> origin/master There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> master PS E:\code> git pull origin master From https://github.com/zhi-nian/VuePractice * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories PS E:\code> git pull origin master --allow-unrelated-histories From https://github.com/zhi-nian/VuePractice * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md
完事兒直接用編輯器從新提交代碼 ok!
4、代碼下拉
一、代碼下拉遇到的問題
二、解決辦法
切換到項目所在目錄,在命令行窗口輸入
git branch --set-upstream master origin/master 或 git branch --track master origin/master
執行結果以下:
PS E:\code> git branch --set-upstream master origin/master
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
Branch master set up to track remote branch master from origin.
這樣就ok了 能夠下拉更新了
5、刪除倉庫 步驟以下圖
一、
二、
三、
四、完成