如何將本地項目上傳到gitee 碼雲


1.打開項目根目錄,使用 git init 命令,初始化一個git本地倉庫(項目),會在本地創建一個 .git 的文件夾

git init

 

2.在碼雲創建項目TestApp

 

3.使用git remote add origin TestApp的git克隆地址 //添加遠程倉庫
// 示例:git remote add origin https://gitee.com/xxxx/TestApp.git

 

4.使用 git pull origin master 命令,將碼雲上的倉庫pull到本地

 

5.將要上傳的文件,添加到剛剛創建的文件夾fighting里

 

6.使用git add . 或者 git add + 文件名 (將文件保存到緩存區)

 

7.使用git commit -m ‘描述新添加的文件內容’ (就是提交代碼的注釋) (文件保存到本地倉庫),初次提交報如下錯誤,原因是沒有配置認證信息

$ git commit -m 項目初始化
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

  

8.設置用戶和郵箱

Administrator@xds MINGW64 /d/phpstudy_pro/WWW/yii-admin (master)
$ git config --global user.name testApp

Administrator@xds MINGW64 /d/phpstudy_pro/WWW/yii-admin (master)
$ git config --global user.email testApp@qq.com

 

9.生成秘鑰對

$ ssh-keygen -t rsa -C "testApp@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/你的windows用戶賬號/.ssh/id_rsa):

  執行上面命令后,一路按enter鍵, 出現如下結果,表示秘鑰對生成成功

Your public key has been saved in /c/Users/你的windows用戶賬號/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:CYq2qk/tD8TCb+96POVfQn06fvMbYM3O8ZdtggK6ahgA testApp@qq.com
The key's randomart image is:
+---[RSA 3072]----+
|            ..   |
|           .  .  |
|      o   .  . . |
| . o E . o o  = .|
|  = + + S + .o.=.|
| . *   +.o  .o+ +|
|  o =. o  . +  +.|
| o o o+ .  + .o .|
|+.. o=+. .. .. +o|
+----[SHA256]-----+

 轉移到 /c/Users/你的windows用戶賬號/.ssh 目錄下,將rsa.pub里面的公鑰復制到粘貼板

 

10.登錄碼雲gitee.com,轉移到設置頁面,將上一步復制的公鑰粘貼保存

 

 

11.使用git push origin master,將本地倉庫推送到遠程倉庫

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM