1.git下載地址:http://git-scm.com/downloads
2.git安裝:打開下載的安裝程序 執(zhí)行next就可以了。
3.項(xiàng)目管理:
① git clone 不同協(xié)議方式
git clone git@github.com:用戶/項(xiàng)目名稱.git --SSH協(xié)議
git clone git://github.com/用戶/項(xiàng)目名稱.git --GIT協(xié)議
git clone https://github.com/用戶/項(xiàng)目名稱.git --HTTPS協(xié)議
注:git協(xié)議需要在本地生成訪問秘鑰(ssh-keygen -t rsa -C"郵箱地址"),然后在git服務(wù)器配置內(nèi)添加配置好的秘鑰。
② git commit,git push,git pull,git fetch,git merge的含義與區(qū)別
?git commit:是將本地修改過的文件提交到本地庫中;
?git push:是將本地庫中的最新信息發(fā)送給遠(yuǎn)程庫;
?git pull:是從遠(yuǎn)程獲取最新版本到本地,并自動(dòng)merge;
?git fetch:是從遠(yuǎn)程獲取最新版本到本地,不會(huì)自動(dòng)merge;
?git merge:是用于從指定的commit(s)合并到當(dāng)前分支,用來合并兩個(gè)分支;
③ git push?
當(dāng)git push提示錯(cuò)誤“fatal: remote error:You can't push to git://github.com/Gitwudao/HelloWorld.git Use https://github.com/Gitwudao/HelloWorld.git”。
解決方案如下:
git remote rm origin
git remote add origin git@github.com:【用戶名】/項(xiàng)目名.git
git push origin
git push --set-upstream origin master
操作教程參考:https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5