1.安裝git
># sudo apt-get build-dep git-core git-doc
這個會安裝git-core和git-doc依賴的庫。
接下來去官網下載git的源碼包。把下載的git包解壓。
在解壓的目錄下執行下列的命令來編譯git
>#make prefix=/usr/local all doc
然後需要安裝git
>#sudo make install install install-doc
這樣你的git就可以被該計算機上的所有用戶使用了。
你可以使用下面的命令來查看自己的git版本號。
>#git --version
2.配置git
由於git並不像svn那樣有中心倉庫,所以並不需要想中心倉庫提供用戶名和密碼等。但是我們還是需要告訴
要通過用戶名和email地址來給git傳遞一些信息。這些信息通常被設置爲global。這裏必須設置的兩個是user.name
和user.email。user.name是提交代碼時顯示的名稱,user.email可以被其他開發者用於聯繫你使用。
>#git config --global user.name "your name"
>#git config --global user.email "[email protected]"
然後我們可以通過下面的命令來查看是否修改成功了呢。
>#git config --global --list
我們應該會看到我們剛纔配置的信息。
除此之外,還可以調整git的顯示顏色來區分不同的變化。
>#git config --global color.ui "auto"
3.查看git幫助
>#git help
命令可以查看git的命令
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
如果想查看git的具體命令使用可以通過下面命令做到,例如查看clone命令。
>#git help clone
到這我們已經配置好我們的git了,接下來就可以創建我們的工程了。明天接着寫喲。
轉載地址:http://blog.csdn.net/weidawei0609/article/details/6584494