1. 程式人生 > 實用技巧 >如何將本地專案上傳到gitee 碼雲

如何將本地專案上傳到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 "[email protected]"
  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 [email protected]

9.生成祕鑰對

$ ssh-keygen -t rsa -C "[email protected]"
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 [email protected]
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,將本地倉庫推送到遠端倉庫