顯示隱藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true
創(chuàng)建SSH Key
$ ssh-keygen -t rsa -C "xxx@163.com"
一路回車(chē),可以在用戶(hù)主目錄里找到.ssh,里面有id_rsa和id_rsa.pub兩個(gè)文件
id_rsa為私鑰,不能泄露,id_rsa.pub是公鑰,放在git服務(wù)器
從本地push到遠(yuǎn)程
關(guān)聯(lián)一個(gè)遠(yuǎn)程庫(kù)
$ git remote add origin gitPath/repo-name.git
關(guān)聯(lián)后,使用命令
$ git push -u origin master 第一次推送master分支的所有內(nèi)容
此后,每次本地提交后,只要有必要,就可以使用命令
$ git push origin master 推送最新的修改
在遠(yuǎn)程創(chuàng)建然后克隆
$ git clone https://github.com/yzgcode/gitskills.git
或者(推薦,但是某些公司只開(kāi)放https端口無(wú)法使用)
$ git clone git@github.com:yzgcode/gitskills.git
git 支持多種協(xié)議 ,包括https,但通過(guò)ssh支持的原生git協(xié)議速度最快
使用https除了速度慢以外,還有個(gè)最大的麻煩是每次推送都必須輸入口令
默認(rèn)的git://使用ssh