1. 下載並安裝Git 2.8.x版本
2. 配置Git 2.8.x
3. 上傳項目
4.關於報錯解決
5.注意事項以及說明
前提:必定先創建好遠程倉,以下圖所示git
1.1 下載github
下載網址以下:https://git-for-windows.github.io/windows
1.2 安裝bash
雙擊該軟件完成,具體細節暫時省略。。。ssh
2.1 配置用戶名(提交時會引用)ide
鼠標右擊項目,點擊 git bash herefetch
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission
$ git config --global user.name "Your Name" //舉個栗子:git config --global user.name "loubobooo"
2.2 配置郵箱(提交時會引用)idea
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git config --global
user.email "Your Email Address" //舉個栗子:git config --global user.email "332143898@qq.com"
3.1 初始化git倉spa
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git init
3.2 添加本地文件到暫存區(三種方式)rem
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git add --all
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git add
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git add README.md
3.3 添加本地文件到版本庫
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git commit -m "你的註釋"
3.4 添加遠程倉庫地址
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git remote add origin https://gitee.com/xxx/xxx.git //舉個栗子:git remote add origin https://gitee.com/loubobooo/mmall.git
3.5 向遠程倉庫推送代碼(這裏沒有使用ssh祕鑰方式提交)
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git push origin master
若是出現如下報錯:
error: failed to push some refs to 'xxx(遠程倉)'
緣由是:遠程倉中的README.md不在本地代碼目錄中
能夠經過以下命令進行代碼合併【注:pull=fetch+merge]
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git pull --rebase origin master
執行上面代碼後能夠看到本地代碼庫中多了README.md文件
再執行語句
loubobooo@loubobooo MINGW64 /d/ideaIU-15.0.6/workspace/IdeaProjects/permission $ git push -u origin master