1. 管理git ssh key
創(chuàng)建key pairs
ssh-keygen -t rsa -C "youremail@yourcompany.com"
~目錄下會(huì)生成.ssh目錄,包含id_rsa.pub和id_rsa兩個(gè)文件
添加private key
ssh-add ~/.ssh/id_rsa
如果出現(xiàn)錯(cuò)誤,可以先使用如下命令
ssh-agent bash
在profile settings->SSH Keys->Add SSH Key中添加id_rsa.pub中內(nèi)容
然后進(jìn)行連接炕檩,
ssh -T git@gitlab.yourdoman
成功會(huì)顯示
Welcome to GitLab, xxx
如果出現(xiàn)提示SSL證書錯(cuò)誤僻孝。如下
fatal: unable to access 'https://github.com/subying/jsbook.git/': SSL certificate problem: unable to get local issuer certificate
可以使用如下命令跳過SSL證書驗(yàn)證
git config --global http.sslVerify false
2. git push內(nèi)容
將目錄變成git管理的倉庫
get init
添加origin
git remote add origin git@gitlab.{your domain}.git
如果git上內(nèi)容比本地新芹关,pull內(nèi)容到本地
git pull origin master
添加或更新本地內(nèi)容到git
git add {your file}
git commit -m "your commit"
git push origin master
替換本地改動(dòng)
git checkout -- <filename>