標籤:
(軟體及教程下載分享:連結:http://pan.baidu.com/s/1dFysay9 密碼:pug0)
1-安裝Git-2.9.2-64-bit.exe(解壓安裝檔案,運行安裝程式,除了記得修改下安裝路徑外就一路預設下一步安裝著去)
2-串連配置Git環境:
2.1-首先在本地建立ssh key;
2.1.1-啟動Git Bash Here:
2.1.2-輸入下面代碼,後面的[email protected]改為你在github上註冊的郵箱
$ssh-keygen -t rsa -C "[email protected]" //郵箱填寫自己的git帳號
2.2-回到github上,進入 Account Settings(賬戶配置),左邊選擇SSH Keys,Add SSH Key,title隨便填,粘貼在你電腦上產生的key.
2.2.1-填加圖解:
2.2.2-驗證是否成功,在git bash下輸入:$ ssh -T [email protected]
如果是第一次的會提示是否continue,
輸入yes就會看到:You‘ve successfully authenticated, but GitHub does not provide shell access 。
這就表示已成功連上github。
3-把本地倉庫傳到github上去:
3.1-在此之前還需要設定一次username(使用者名稱)和email(郵箱),這是非常重要的,因為github每次commit(提交)都會記錄他們
$ git config --global user.name "your name"
$ git config --global user.email "[email protected]"
我的: git config --global user.name " czy95"
git config --global user.email "*******@qq.com"
查看配置資訊: $ git config –list
3.2-建立一個github倉庫並增加分支:
3.2.1-建立一個github倉庫:
3.2.2-建立一個gh-pages分支:
3.3-Clone遠程倉庫到本地:
需要用到的命令:
$ git clone https://github.com/使用者名稱/庫名.git //將git庫下載到本地
我的:$ git clone https://github.com/czy95/czy.git
$ cd 庫名 //進入下載好的庫檔案目錄下
我的:$ cd czy
$ git checkout -b gh-pages origin/gh-pages //切換到gh-paes分支
3.4-刪除裡面的所有檔案,最好不要直接刪除,通過git命令刪除:
需要用到的命令:
$ git rm -rf .
$ git add .
$ git commit -m "delete all files"
3.5-提交代碼到gh-gages分支:
需要用到的命令:
$ git add .
$ git commit -m "add czyClock" //最後面的參數相當於修改檔案的備忘
$ git push origin gh-pages //將代碼提交到gh-gaes分支
4-完成查看效果:
Ok!!!
開始寫於:2016.10.12 ----志銀
Win764位配置Github環境及將代碼部署到Gtihub pages-志銀強勢總結