codecamp

Mac开发配置 Git安装 与 Github配置

Git and Github

作为一名开发者怎么可能没有 Git 呢? 我们马上就来安装:

$ brew install git  

好的,现在我们来测试一下 git 是否安装完好:

$ git --version  

运行 $ which git 将会输出 /usr/local/bin/git.

接着,我们将定义你的 Git 帐号(与你在 GitHub 使用的用户名和邮箱一致)

$ git config --global user.name "Your Name Here"
$ git config --global user.email "your_email@youremail.com"  

这些配置信息将会添加进 ~/.gitconfig 文件中.

我们将推荐使用 HTTPS 方法(另一个是 SSH),将你的代码推送到 Github 上的仓库。如果你不想每次都输入用户名和密码的话,可以按照此 描述 说的那样,运行:

$ git config --global credential.helper osxkeychain 

此外,如果你打算使用 SSH 方式,可以参考此 链接.

Git Ignore

创建一个新文件 ~/.gitignore ,并将以下内容添加进去,这样全部 git 仓库将会忽略以下内容所提及的文件。

\# 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  
如何安装Mac 上最强大的终端 iTerm2
Mac开发配置之MySQL的安装与使用
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }