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