網(wǎng)站建設(shè)語(yǔ)百度搜索大全
目錄
1)使用 git 命令行安裝 git
2)在 Gitee 創(chuàng)建倉(cāng)庫(kù)
創(chuàng)建倉(cāng)庫(kù)
3)Linux克隆倉(cāng)庫(kù)到本地
4)提交代碼三板斧:
1.三板斧第一招: git add
2.三板斧第二招: git commit
3.三板斧第三招: git push
5)所遇問(wèn)題
解決git上傳提交的時(shí)出現(xiàn):Please tell me who you are.問(wèn)題
1)使用 git 命令行安裝 git
yum install git
2)在 Gitee 創(chuàng)建倉(cāng)庫(kù)
參考文章
新手使用——Gitee教學(xué)_gitee新手_IfYouHave的博客-CSDN博客https://blog.csdn.net/IfYouHave/article/details/129005774
創(chuàng)建倉(cāng)庫(kù)
1. 登陸成功后, 進(jìn)入個(gè)人主頁(yè), 點(diǎn)擊左下方的 New repository 按鈕新建項(xiàng)目
2. 然后跳轉(zhuǎn)到的新頁(yè)面中輸入項(xiàng)目名稱(注意, 名稱不能重復(fù), 系統(tǒng)會(huì)自動(dòng)校驗(yàn). 校驗(yàn)過(guò)程可能會(huì)花費(fèi)幾秒鐘). 校驗(yàn) 完畢后, 點(diǎn)擊下方的 Create repository 按鈕確認(rèn)創(chuàng)建.
?倉(cāng)庫(kù)名稱盡量采用英文,初始化創(chuàng)庫(kù),模板通常選擇Readme文件
3. 在創(chuàng)建好的項(xiàng)目頁(yè)面中復(fù)制項(xiàng)目的鏈接, 以備接下來(lái)進(jìn)行下載.
一般都使用HTTPS鏈接?
3)Linux克隆倉(cāng)庫(kù)到本地
創(chuàng)建好一個(gè)放置代碼的目錄.
git clone [url]
依次輸入gitee注冊(cè)是使用郵箱或者手機(jī)號(hào),其次輸入密碼
sucess后
?
這里的 url 就是剛剛建立好的 項(xiàng)目 的鏈接.
4)提交代碼三板斧:
1.三板斧第一招: git add
將代碼放到剛才下載好的目錄中 git clone [url]
git add [文件名]
將需要用 git 管理的文件告知 git
2.三板斧第二招: git commit
提交改動(dòng)到本地
git commit .
最后的 "." 表示當(dāng)前目錄 提交的時(shí)候應(yīng)該注明提交日志, 描述改動(dòng)的詳細(xì)內(nèi)容.
3.三板斧第三招: git push
同步到遠(yuǎn)端服務(wù)器上
git push
需要填入用戶名密碼. 同步成功后, 刷新 Github 頁(yè)面就能看到代碼改動(dòng)了.
4.提交記錄:git log
git log
查看歷史提交記錄
5.編輯.gitignore
vim .gitignore
通過(guò)編輯此文件,可以將不想要提交的一些文件的后綴加入,就會(huì)進(jìn)行屏蔽
?6.刪除文件git rm 文件名
git rm 文件名?
刪除后執(zhí)行三板斧,代碼托管中心的遠(yuǎn)程倉(cāng)庫(kù)也會(huì)刪除
5)所遇問(wèn)題
解決git上傳提交的時(shí)出現(xiàn):Please tell me who you are.問(wèn)題
*** Please tell me who you are.Rungit config --global user.email "you@example.com"git config --global user.name "Your Name"to set your account's default identity.
Omit --global to set the identity only in this repository.fatal: empty ident name (for <customer@VM-4-10-centos.(none)>) not allowed
提示:Please tell me who you are.
翻譯過(guò)來(lái)就是:請(qǐng)告訴我你是誰(shuí)。
就是說(shuō)這里git無(wú)法識(shí)別你是誰(shuí),你需要告訴 git 你的身份。
其實(shí)提示已經(jīng)告訴了你的問(wèn)題:git config --global user.email "you@example.com" git config --global user.name "Your Name"
解決辦法是在 終端命令行,依次輸入以下命令并依次輸入你的郵箱與名稱:
git config --global user.email "郵箱" git config --global user.name "名稱"
在命令行輸入回車(chē)之后,使用以下命令查看git 信息
git config -l
繼續(xù)提交即可?