下載地址
//官方地址
https://git-scm.com/downloads
//鏡像地址
https://npm.taobao.org/mirrors/git-for-windows/
安裝
默認(rèn)下一步满钟,一直點(diǎn)
調(diào)用命令行窗口炫隶,輸入git,測(cè)試安裝是否成功
使用
##輸入自己想要的用戶名和郵箱茫死,不然后面提交不了
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
##查看設(shè)置
git config --global --list
##初始化倉庫,去到要初始化倉庫的目錄最冰,執(zhí)行
git init
##添加到版本管理
git add src
##提交
git commit -m "備注說明"
##查看提交記錄
git log
##忽略文件狭魂,不讓版本控制
創(chuàng)建.gitignore文件
vim .gitignore
輸入要忽略的文件夾或文件
.idea/
target/
log/
game_framework.iml
##回退被廓,回退到緩存區(qū)或版本區(qū)的最新版本,優(yōu)先回退到緩沖區(qū)這版本
git checkout --.gitignore
使用gitee遠(yuǎn)程倉庫
注冊(cè)登錄:https://gitee.com/
1谅海、創(chuàng)建一個(gè)新的的倉庫
2脸哀、將git安裝目錄的user/bin的完整路徑追加到到環(huán)境變量 path 后面
eg:D:\VersionManagement\Git\usr\bin
3、創(chuàng)建ssh公鑰扭吁,調(diào)出控制臺(tái)撞蜂,輸入 ssh-keygen -t rsa -C "隨便" 盲镶,一直回車
4、用記事本打開公鑰蝌诡,將公鑰復(fù)制到 gitee的 “設(shè)置”>“ssh公鑰”溉贿,保存
5、將本地倉庫與遠(yuǎn)程倉庫關(guān)聯(lián)
#origin 遠(yuǎn)程倉庫最好不改浦旱,后面的地址是gitee上面的
git remote add origin git@gitee.com:quanhui/game_framework.git
6宇色、先將遠(yuǎn)程倉庫的同步到本地
git pull origin master --allow-unrelated-histories
7、在將本地內(nèi)容推送到遠(yuǎn)程倉庫
git push origin master