1. 程式人生 > >專案檔案託管到 碼雲(git 也是同理)

專案檔案託管到 碼雲(git 也是同理)

關於 git 的入門使用,參見:git 新手入門
關於 git 原理,參見:阮一峰 git 原理

0.生成 SSH key

  1. ssh-keygen -t rsa -C “郵箱”

注意:報錯Too many arguments.是因為上面的 -C 不可以寫成 -c

根據提示,按三次回車鍵,最後在 id_rsa.pub(記事本開啟就行了) 會生成 ssh key 值,並告訴你 key 值存放的檔案的位置,找到該檔案並複製 ssh key

  1. 開啟你的github主頁。找到Settings,
    在這裡插入圖片描述
  2. 選擇SSH and GPG keys ,再選擇new SSH key,title 隨意填,key值就是剛剛生成的本機 SSH KEY
    在這裡插入圖片描述

1.專案根目錄下新建 .gitignore

配置下面屬性(就是上傳時要忽略的資料夾,減小上傳體積)

.idea 是指使用編輯器(如 webstorm 等)的預設配置檔案

node_modules
.idea
.vscode
.git

2.專案根目錄下新建 README.md

是用來告訴專案相關資訊的,如下面的相關資訊
## [主流開源協議之間有何異同?](https://www.zhihu.com/question/19568896)

## 用(傳統方式)命令列把修改過後的程式碼上傳到碼雲???
1. git add .
2. git commit -m "提交資訊"
3. git push

## 製作首頁App元件
1. 完成 Header 區域,使用的是 Mint-UI 中的Header元件
2. 製作底部的 Tabbar 區域,使用的是 MUI 的 Tabbar.html
 + 在製作 購物車 小圖示的時候,操作會相對多一些:
 + 先把 擴充套件圖示的 css 樣式,拷貝到 專案中
 + 拷貝 擴充套件字型庫 ttf 檔案,到專案中
 + 為 購物車 小圖示 ,新增 如下樣式 `mui-icon mui-icon-extra mui-icon-extra-cart`
3. 要在 中間區域放置一個 router-view 來展示路由匹配到的元件

## 改造 tabbar 為 router-link

## 設定路由高亮

## 點選 tabbar 中的路由連結,展示對應的路由元件

## 製作首頁輪播圖佈局

## 載入首頁輪播圖資料
1. 獲取資料, 如何獲取呢, 使用 vue-resource
2. 使用 vue-resource 的 this.$http.get 獲取資料
3. 獲取到的資料,要儲存到 data 身上
4. 使用 v-for 迴圈渲染 每個 item 項

## 改造 九宮格 區域的樣式

在這裡插入圖片描述

3.專案根目錄下引入開源協議 LICENSE

在這裡插入圖片描述
協議佔比:
在這裡插入圖片描述
最常用的協議:

The MIT License (MIT)

Copyright (c) 2014 connors and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4.初始化

命令:git init

使用:git status可以檢視未提交檔案
在這裡插入圖片描述

5.提交檔案

命令:git add .
在這裡插入圖片描述
命令:git commit -m "init my project"
在這裡插入圖片描述
至此提交本地的 git 完畢
在這裡插入圖片描述

5.上傳到碼雲的步驟

具體上傳過程,在新建完可以看見

  1. 建空庫:

在這裡插入圖片描述

  1. 如果沒有繫結過自己的 pc

git config --global user.name "name"
git config --global user.email "email"
  1. 上傳

繫結:git remote add origin [email protected]:shadnyiting/mayun.git
上傳:git push -u origin master

在這裡插入圖片描述
至此上傳成功

6.專案檔案修改上傳碼雲

一、用(傳統方式)命令列把修改過後的程式碼上傳到碼雲

  1. git add .
  2. git commit -m "提交資訊"
  3. git push

二、visual studio code 自帶的提交(由於我是 webstorm,無奈)

7.檔案的刪除

  1. 如果伺服器和碼雲上面的內容不一致,先用git pull origin master
  2. git rm -r --cached filename // 刪除的檔案
  3. git commit -m "delete filename"
  4. git push origin master // 推送到碼雲

追加:

刪除

  1. git rm -r hello.py
  2. git commit -m 'remove hello.py'

新增

  1. git add 資料夾/ 新增整個資料夾及內容
  2. git add *.檔案型別 新增目錄中所有此檔案型別的檔案

新增後注意:

推送

  1. git remote add origin 你的遠端庫地址
  2. git push origin master