一 node 安裝
打開https://nodejs.org/en/ nodejs官網 下載安裝文件 雙擊.pkg 文件 自動安裝即可
二 安裝git
打開 http://code.google.com/p/git-osx-installer/ 下載最新的PGK文件 雙擊.pkg 文件 自動安裝即可。(注:可能遇到 信任問題 可以在 系統偏好設置->安全性與隱私->允許從以下位置下載的應用 選擇繼續安裝)
github使用SSH鏈接,需要設置SSH
1.檢查SSH key
cd ~/.ssh
2.備份已有的key,(如果有的話)
mkdir key_backup
mv id_rsa* key_backup
3.生成SSH key
$ ssh-keygen -t rsa -C sunjianping88@126.com
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/sunjianping88/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): //###這個地方是設置密碼 輸入自己要設置的密碼即可 也可以不輸入
Enter same passphrase again:
Your identification has been saved in yes.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx sunjianping88@126.com
The key's randomart image is:
+---[RSA 2048]----+
|..+= .=B**+*o |
|o o . oo+=o.o |
| . ... o *.. |
| .oE . o = + |
|oo... o S |
|= . . . |
|oo |
|=o. |
|B+ |
+----[SHA256]-----+
4.將SSH key添加到GitHub
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2ExxxzzzzzzQABAAABAQDv7Yb10i+bV5S5sueGVP9NRYYcUKpx+A/IPZS0ZWId469SaIW9ajrGNFSlIwxxxxxxxmhvCGI9nY4c3uD4m3dJvo+EfGduEya4uZS2gPNmZ7osmV6TCdgfTVUqlifK1/rzt0iEyriM8BcIeh+lxb3m/fU+6vuxteqEiHAUArt2dxxxxxxxxxrZxxSNq8He8t+/wSkusCxxxCaoNobxxxxUZHauol7ybqnaNGhW3oTlNnd08RfMv16MtAlKrX5Gvy2jyxchjxXXeL6tQvxxxxxeUyXaLcVSMw+JKLaUHJRG6eBt2rnNvTd35ALx1ObI/qTMxxxxxxxx0jmMhmEVKxshbn sunjianping88@126.com
登錄到GitHub頁面,personal settings ->SSH and GPG Keys->New SSH key
將生成的key(id_rsa.pub文件,即上面命令cat ~/.ssh/id_rsa.pub獲取文件的內容)內容copy到輸入框中,點擊Add SSH key。
5.測試鏈接
$ ssh git@github.com
The authenticity of host 'github.com (192.30.252.122)' can't be established.
RSA key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.122' (RSA) to the list of known hosts.
Saving password to keychain failed
Identity added: /Users/sunjianping/.ssh/id_rsa ((null))
PTY allocation request failed on channel 0
Hi sunjp748! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
出現上述提示信息說明連接成功(github並不提供shell登陸但已經連接成功)
6.設置個人信息
$ git config --global user.name "your_name"
$ git config --global user.email your_email@xxx.com
三 bower安裝
1.輸入命令
$ sudo npm install -g bower
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
bower@1.7.9 /usr/local/lib/node_modules/bower
2.新建.bowerrc文件 設置下載文件的保存目錄
(1)可以在項目根目錄下新建一個txt文件 然后mv x.txt .bowerrc
(2)修改.bowerrc文件內容為
{
"directory" : "public/javascripts/lib"//要保存下載庫文件的目錄
}
3.進入項目目錄中,輸入命令如下 bower init 然后按照提示填寫內容即可 遇到選擇Y/n的選擇Y即可
4.嘗試下下載文件
$ bower install jquery --save
bower not-cached https://github.com/jquery/jquery-dist.git#*
bower resolve https://github.com/jquery/jquery-dist.git#*
bower checkout jquery#2.2.4
bower progress jquery#* Receiving objects: 26% (35/133), 220.00 KiB | 105.00 KiB/s
bower resolved https://github.com/jquery/jquery-dist.git#2.2.4
bower install jquery#2.2.4
jquery#2.2.4 public/javascripts/lib/jquery
出現以上內容證明已經部署成功
(未完待續 gulp構建工具)