作為一名開(kāi)發(fā)者怎么可能沒(méi)有 Git 呢? 我們馬上就來(lái)安裝:
$ brew install git
好的,現(xiàn)在我們來(lái)測(cè)試一下 git 是否安裝完好:
$ git --version
運(yùn)行 $ which git 將會(huì)輸出 /usr/local/bin/git.
接著,我們將定義你的 Git 帳號(hào)(與你在 GitHub 使用的用戶名和郵箱一致)
$ git config --global user.name "Your Name Here"
$ git config --global user.email "your_email@youremail.com"
這些配置信息將會(huì)添加進(jìn) ~/.gitconfig
文件中.
我們將推薦使用 HTTPS 方法(另一個(gè)是 SSH),將你的代碼推送到 Github 上的倉(cāng)庫(kù)。如果你不想每次都輸入用戶名和密碼的話,可以按照此 描述 說(shuō)的那樣,運(yùn)行:
$ git config --global credential.helper osxkeychain
此外,如果你打算使用 SSH 方式,可以參考此 鏈接.
創(chuàng)建一個(gè)新文件 ~/.gitignore
,并將以下內(nèi)容添加進(jìn)去,這樣全部 git 倉(cāng)庫(kù)將會(huì)忽略以下內(nèi)容所提及的文件。
\# Folder view configuration files
.DS_Store
Desktop.ini
\# Thumbnail cache files
._*
Thumbs.db
\# Files that might appear on external disks
.Spotlight-V100
.Trashes
\# Compiled Python files
*.pyc
\# Compiled C++ files
*.out
\# Application specific files
venv
node_modules
.sass-cache
更多建議: