Github及git指令
本章說明Github及git的使用
什麼是git
git是一個分散式版本控制軟體,最初由Linux作者林納斯·托瓦茲(Linus Torvalds)寫的程式,用來維護Linux作業系統核心程式。他於2005年以GPL釋出git,很快取代原先大家常用的版本控制軟體,如(CVS 和Subversion)。原先IBM和微軟都有他們自己的版本控制軟體ClearCase以及Team Foundation Server,然而,在git釋出之後,大家都用git來做版本控制。
GIT 有很多圖形介面程式可以用,包括:
- GitHub Desktop
- Git for Windows
- TortoiseGit
但在課程中,我們主要是教同學使用git指令。 https://goo.gl/5NkRWN
git config --global user.name "Sam Smith"
git config --global user.email [email protected]
git init
git clone username@host:/path/to/repository
git add .
git commit -m "Commit message"
git push origin master
git remote add origin https://github.com/htchutw/webex1.git
git remote add gitbook https://uuu:[email protected]/htc/audbook.git
git pull
什麼是Github
https://github.com/ 是一個透過Git進行版本控制的軟體原始碼代管服務,由Chris Wanstrath、PJ Hyett和Tom Preston-Werner使用Ruby on Rails編寫而成。
GitHub同時提供付費帳戶和免費帳戶。這兩種帳戶都可以建立公開的代碼倉庫,但是付費帳戶還可以建立私有的代碼倉庫。GitHub是最流行的Git存取站點。除了允許個人和組織建立和存取保管中的代碼以外,它也提供了一些方便社會化共同軟體開發的功能,即一般人口中的社群功能,包括允許用戶追蹤其他用戶、組織、軟體庫的動態,對軟體代碼的改動和bug提出評論等。GitHub也提供了圖表功能,用於概觀顯示開發者們怎樣在代碼庫上工作以及軟體的開發活躍程度。GitHub已經成為了世界上最大的代碼存放網站和開源社群。
什麼是Github Pages
Github Pages是GitHub網站提供的網站服務,可以把GitHub上的一個 repository建成一個有url的網站。這個服務有二種型式。其一,對使用者uuu的任何檔案庫(Repository)sss而言:
Repository | https://github.com/uuu/sss |
---|---|
Pages | https://uuu.github.io/sss |
其二,對使用者uuu,可以建一個叫uuu.github.io 的檔案庫(Repository),這個檔案庫會對應到使用者的Pages。
Repository | https://github.com/uuu/uuu.github.io |
---|---|
Pages | https://uuu.github.io/ |
練習一
請同學申請一個GitHub帳號,再新增一個檔案庫webex1, 將此檔案庫建成Github Pages https://uuu.github.io/webex1
`` git clone https://github.com/htchutw/webex2.git cd webex2 git config --global user.email "[email protected]" git config --global user.name "uuu" git init git remote add origin https://github.com/uuu/webex1.git git add . git commit -m "first" git push -u origin master ```