初始化git倉庫
流程: 1.安裝git -> 2.配置git(直接運行程序) -> 3.在github中新建repo -> 4.將本地文件夾和repo關聯,并上傳文件到repo中
-
安裝git工具:
安裝壓縮包中的git工具,全部按照默認設置,一路next
git工具
-
配置git:
右鍵 -> gitbash -> 輸入./git_set.sh
回車
配置git
- 在github中新建repo:
地址: https://github.com/geekz93/
密碼: ****
點擊頁面右上角的+
號 -> New repository
create repository1
輸入repo的名稱后,點擊create repository
create repository2
先不要關閉頁面,這個repo的地址,后面會用到
create repository3
-
關聯本地目錄:
-
將
git.sh 和 .gitignore
文件拷貝到要關聯到repo的目錄中,我這里把金屬樣本這個目錄和上面創建的iron_images
目錄關聯
copy files -
在金屬樣本目錄的空白處右鍵,點擊
git bash here
,輸入./git.sh init
要輸入repo的地址,把上面說的repo地址復制粘貼進去,回車即可
initial -
上傳文件到repo中, 輸入
./git.sh upload
看到writing...done
表示上傳完成,這時刷新之前的網頁就可以看到上傳的文件了~~
upload
-
images in github
在令一臺電腦中配置git
在另一臺電腦中安裝git工具,配置git,和上面步驟1,2一樣操作.
配置好git后,新建一個目錄,把壓縮包中的: git.sh
和 .gitignore
文件拷貝到這個目錄里
new directory
進入gitbash后輸入
./git.sh init
進行初始化(和repo關聯), repo的地址可以在網頁中看到repo site
關聯完成后在bash中輸入./git.sh download
就可以下載repo中的文件了
下載完成了^_^
日常使用
完成上面的配置后,日常使用就非常簡單了: 過程如圖所示
公司和家里的電腦同步文件
兩臺電腦都的金屬樣本目錄都和github上的iron_images目錄關聯了.在公司的電腦里往金屬樣本目錄里添加東西后,使用
./git.sh upload
上傳到github上
回家后進入金屬樣本目錄使用
./git.sh download
下載github上的新內容, 同樣在家里工作完了, 新增加的內容也可以upload到github上, 到工作再download下來接著做