天天看點

學會Git玩轉Github筆記(二)——Git使用

一、Git基本工作流程

Git工作區域

學會Git玩轉Github筆記(二)——Git使用

向倉庫中添加檔案流程

學會Git玩轉Github筆記(二)——Git使用

二、 Git初始化及倉庫建立和操作

基本資訊設定

1. 設定使用者名
git config --global user.name 'itcastphpgit1'

2. 設定使用者名郵箱
git config --global user.email '[email protected]'      

腳下留心:該設定在github倉庫首頁顯示誰送出了該檔案

初始化一個新的Git倉庫

1、建立檔案夾

學會Git玩轉Github筆記(二)——Git使用

2、在檔案内初始化git(建立git倉庫)

cd test    #進入項目檔案夾
git init   #初始化      
學會Git玩轉Github筆記(二)——Git使用

向倉庫添加檔案

touch a1.php                         # 建立a1.php檔案到工作目錄
git add a1.php                      # 添加a1.php到暫存區
git commit -m  '第一次送出檔案'     # 添加a1.php到倉庫      
學會Git玩轉Github筆記(二)——Git使用
學會Git玩轉Github筆記(二)——Git使用
學會Git玩轉Github筆記(二)——Git使用

修改倉庫檔案

學會Git玩轉Github筆記(二)——Git使用
學會Git玩轉Github筆記(二)——Git使用
學會Git玩轉Github筆記(二)——Git使用

删除倉庫檔案

學會Git玩轉Github筆記(二)——Git使用

三、Git管理遠端倉庫

使用遠端倉庫的目的

作用:備份,實作代碼共享集中化管理

學會Git玩轉Github筆記(二)——Git使用
學會Git玩轉Github筆記(二)——Git使用

Git克隆操作

目的

将遠端倉庫(github對應的項目)複制到本地

代碼

git clone 倉庫位址

學會Git玩轉Github筆記(二)——Git使用

多學一招:倉庫位址由來

學會Git玩轉Github筆記(二)——Git使用

将本地倉庫同步到git遠端倉庫中

git push

學會Git玩轉Github筆記(二)——Git使用

︴思考:為什麼無法同步,或沒有權限 ?

The requested URL returned error: 403 Forbidden while accessing

學會Git玩轉Github筆記(二)——Git使用