碼云 Git ee

? github? ? ?

11.如何將我們的前端項(xiàng)目通過(guò)Git上傳到碼云、github

11.1 要在你的本地安裝Git? https://git-scm.com/

11.2 你要注冊(cè)一個(gè)碼云的賬號(hào)(用郵箱注冊(cè)),然后確認(rèn)郵箱

11.3 我們要想利用vscode向碼云上傳代碼,需要安裝一個(gè) git 并進(jìn)行環(huán)境變量配置

參考網(wǎng)址:

? ? ? ? ? ? ? ? ? ? https://www.cnblogs.com/qingmuchuanqi48/p/12052289.html

? 11.4 生成/添加SSH公鑰(按照文檔操作就可以)

? 參考網(wǎng)址

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? https://gitee.com/help/articles/4181#article-header0

? 11.5 新創(chuàng)建一個(gè)倉(cāng)庫(kù)

? 11.6 從碼云的倉(cāng)庫(kù)中克隆一個(gè)項(xiàng)目(https://gitee.com/liu705195178/vue_01.git)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git clone https://gitee.com/liu705195178/vue_01.git

此時(shí)就會(huì)從倉(cāng)庫(kù)中下載我們所創(chuàng)建好的項(xiàng)目 vues_demos 然后將我們的文件拖到這個(gè)文件夾中

11.7 Git 全局設(shè)置:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git config --global user.name "liu705195178"

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git config --global user.email "705195178@qq.com"

? ? ? ? ? ? ? ? ? ? ? ? 11.8 將代碼上傳到碼云

? ? ? ? ? ? ? ? ? ? ? ? ? ? 1.cd master進(jìn)入到我們的項(xiàng)目文件夾

? ? ? ? ? ? ? ? ? ? ? ? ? ? 2. 先要查看一下當(dāng)前git項(xiàng)目的狀態(tài)? git status

? ? ? ? ? ? ? ? ? ? ? ? ? ? 3. 將要提交的文件添加到git緩沖區(qū)? git add .

? ? ? ? ? ? ? ? ? ? ? ? ? ? 你要提交的文件也經(jīng)添加到緩沖區(qū)了,只有把要提交的文件添加到緩沖區(qū),才能將這些文件提交到服務(wù)器上

? ? ? ? ? ? ? ? ? ? ? ? ? ? 4. 添加一個(gè)遠(yuǎn)程連接

? ? ? ? ? ? ? ? ? ? ? ? ? ? git remote add origin https://gitee.com/liu705195178/vue_01.git


? ? ? ? ? ? ? ? ? ? ? ? ? ? 如果已有遠(yuǎn)程連接可以使用 git remote rm origin 先刪除,然后再添加

? ? ? ? ? ? ? ? ? ? ? ? ? ? 5.將文件上傳到碼云服務(wù)器

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git push -u origin master (master表示主分支? -u表示強(qiáng)制? push上傳? orgin遠(yuǎn)程連接名)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 提交的時(shí)候報(bào)錯(cuò)了,那是因?yàn)槲覀儺?dāng)前文件一直在添加新的內(nèi)容,是在本地

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git init

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git add .

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git status

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git commit -m "project init" 提交一些項(xiàng)目的信息 project init 為提示信息,隨意寫(xiě)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git status 查看當(dāng)前的狀態(tài)如果為clean就可以了

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git push -u origin master 上傳文件? master 為分支名稱(chēng),別的分支就寫(xiě)別的名字

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 如果成功了顯示

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Enumerating objects: 16, done.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Counting objects: 100% (16/16), done.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Delta compression using up to 4 threads

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Compressing objects: 100% (16/16), done.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Writing objects: 100% (16/16), 6.16 KiB | 3.08 MiB/s, done.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Total 16 (delta 9), reused 0 (delta 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? remote: Powered by GITEE.COM [GNK-5.0]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? To git remote add origin https://gitee.com/liu705195178/vue.git

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? * [new branch]? ? ? master -> master

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Branch 'master' set up to track remote branch 'master' from 'origin'.? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? master是主分支,大家不可以把你們的代碼上傳到主分支所以你需要?jiǎng)?chuàng)建自己的分支,并

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 在自己的分支下寫(xiě)代碼,如果某個(gè)模塊寫(xiě)完后,你可以提交到你自己的分支上面,如果管理員同意

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 最后才能把你子分支的代碼合并到master主分支

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 如何創(chuàng)建一個(gè)分支?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1. 查看目前都有哪些分支? git branch? ? 使用Q就退出了。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2. 創(chuàng)建自己的分支 git checkout -b 分支名稱(chēng)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3. git push -u origin zhangjun? 就可以將內(nèi)容上傳到子分支了


? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 切換分支

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git checkout 分支名

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 合并分支

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git merge 其他分支名? (先切換到主分支)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error: failed to push some refs to ‘https://gitee.com/*/.git’

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 解決辦法就是執(zhí)行如下命令

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git pull --rebase origin master

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Git提交Everything up-to-date Branch 'master' set up to track remote branch 'master' from 'origin'如何解決?


? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 先執(zhí)行命令 git log,這個(gè)老重要咯。。幾乎決定生死。。。。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 按鍵盤(pán)q鍵,Enter退出

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 執(zhí)行命令git rebase --abort,則會(huì)看到右側(cè)的()里的內(nèi)容已經(jīng)變成咯主分支,并且沒(méi)有咯REBASE 1/1

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fatal: remote origin already exists.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? git remote rm origin

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容