一、下载安装Git

1、下载Git  官方地址为:https://git-scm.com/download/win

2、下载完之后,双击安装

3、选择安装目录

4、选择组件

5、开始菜单目录名设置

6、以下步骤依次执行

7、安装完成

9、检验是否安装成功

回到电脑桌面,鼠标右击如果看到有两个git单词则安装成功

二、Git初始化操作

1、Git安装之后需要进行一些基本信息设置

  a、设置用户名:git  config -- global  user.name  '你再github上注册的用户名';

  b、设置用户邮箱:git  config -- global  user.email  '注册时候的邮箱';

注意:该配置会在github主页上显示谁提交了该文件

  c、配置ok之后,我们用如下命令来看看是否配置成功

  git config --list

注意:git  config --global 参数,有了这个参数表示你这台机器上所有的git仓库都会使用这个配置,当然你也可以对某个仓库指定不同的用户名和邮箱

以下是一些字符等参数配置:

git config --global core.autocrlf false

#让git不要管win/unix换行符转换的事

git config --global gui.encoding utf-8

#避免git gui中的中文乱码

git config --global core.quotepath off

#避免git status 显示的中文文件名称乱码

window中配置:

git config --global core.ignorecase false

1.ssh key pair配置

ssh-keygen -t rsa -C "a454902046@163.com"

然后一路回车,不要输入任何密码,生成ssh key pair

2.公钥添加到github账号:

3.下载自己的代码:

git clone git@github.com:pinghengxing/shoping.git

如果出现以上提示,按照提示,在hosts【C:\Windows\System32\drivers\etc\hosts】中添加以下内容并重试重试:

13.250.177.223  github.com

基本命令:

git branch

#显示本地分支

git branch -r

#显示远程分支

git checkout  分支名称

#切换到对应分支

git pull

#拉取

#git push

#提交

三、Git克隆操作

目的:将远程仓库(github上对应的项目)复制到本地

1、代码:git clone 仓库地址

仓库地址由来如下:

2、克隆项目

3、将本地仓库同步到git远程仓库中:git push

或者如下示例::

四、git本地创建仓库提交代码过程

D:\idea workspace\mmall>git init
Initialized empty Git repository in D:/idea workspace/mmall/.git/

D:\idea workspace\mmall>git status
On branch master

No commits yet

Untracked files:
(use "git add <file>..." to include in what will be committed)

.gitignore
README.md
mmall.iml
pom.xml
src/

nothing added to commit but untracked files present (use "git add" to track)

D:\idea workspace\mmall>git status
On branch master

No commits yet

Untracked files:
(use "git add <file>..." to include in what will be committed)

.gitignore
README.md
pom.xml
src/

nothing added to commit but untracked files present (use "git add" to track)

D:\idea workspace\mmall>git add .

D:\idea workspace\mmall>git status
On branch master

No commits yet

Changes to be committed:
(use "git rm --cached <file>..." to unstage)

new file: .gitignore
new file: README.md
new file: pom.xml
new file: src/main/webapp/WEB-INF/web.xml
new file: src/main/webapp/index.jsp

D:\idea workspace\mmall>git commit -am '项目初始化'
[master (root-commit) 5674ee3] '项目初始化'
5 files changed, 115 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp

D:\idea workspace\mmall>git remote add origin
usage: git remote add [<options>] <name> <url>

-f, --fetch fetch the remote branches
--tags import all tags and associated objects when fetching
or do not fetch any tag at all (--no-tags)
-t, --track <branch> branch(es) to track
-m, --master <branch>
master branch
--mirror[=<push|fetch>]
set up remote as a mirror to push to or fetch from

D:\idea workspace\mmall>git remote add origin git@github.com:pinghengxing/shoping_mall.git

D:\idea workspace\mmall>git branch
* master

D:\idea workspace\mmall>git push -u origin master
To github.com:pinghengxing/shoping_mall.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:pinghengxing/shoping_mall.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

D:\idea workspace\mmall>git pull
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:pinghengxing/shoping_mall
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

D:\idea workspace\mmall>git push -u origin master
To github.com:pinghengxing/shoping_mall.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:pinghengxing/shoping_mall.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

D:\idea workspace\mmall>git push -u -f origin master
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.61 KiB | 330.00 KiB/s, done.
Total 11 (delta 0), reused 0 (delta 0)
To github.com:pinghengxing/shoping_mall.git
+ 42fd514...5674ee3 master -> master (forced update)
Branch 'master' set up to track remote branch 'master' from 'origin'.

D:\idea workspace\mmall>git branch
* master

D:\idea workspace\mmall>git branch -r
origin/master

D:\idea workspace\mmall>git checkout -b v1.0 origin/master
Switched to a new branch 'v1.0'
Branch 'v1.0' set up to track remote branch 'master' from 'origin'.

D:\idea workspace\mmall>git branch -r
origin/master

D:\idea workspace\mmall>git branch
master
* v1.0

D:\idea workspace\mmall>git push origin HEAD -u
Total 0 (delta 0), reused 0 (delta 0)
To github.com:pinghengxing/shoping_mall.git
* [new branch] HEAD -> v1.0
Branch 'v1.0' set up to track remote branch 'v1.0' from 'origin'.

D:\idea workspace\mmall>git branch -r
origin/master
origin/v1.0

D:\idea workspace\mmall>git branch
master
* v1.0

参考学习:https://www.cnblogs.com/ximiaomiao/p/7140456.html

git 安装配置的更多相关文章

  1. Git 安装配置手册

    Git 安装配置手册 首先我们要了解 Git 是类似于 SVN 用来管理项目的 首先要先下载 Git ,这个东西相当于一个核,是该功能的核心 下载地址(<https://gitforwindow ...

  2. Git安装配置和提交本地代码至Github,修改GitHub上显示的项目语言

    1. 下载安装git Windows版Git下载地址: https://gitforwindows.org/ 安装没有特别要求可以一路Next即可,安装完成后可以看到: 2. 创建本地代码仓库 打开G ...

  3. Git-Runoob:Git 安装配置

    ylbtech-Git-Runoob:Git 安装配置 1.返回顶部 1. Git 安装配置 在使用Git前我们需要先安装 Git.Git 目前支持 Linux/Unix.Solaris.Mac和 W ...

  4. Linux下git安装配置

    一.Linux下git安装配置 2013-07-28 20:32:10|  分类: 默认分类 |  标签:linux  git  server  |举报|字号 订阅     http://abomby ...

  5. 【第二篇】- Git 安装配置之Spring Cloud直播商城 b2b2c电子商务技术总结

    Git 安装配置 在使用Git前我们需要先安装 Git.Git 目前支持 Linux/Unix.Solaris.Mac和 Windows 平台上运行. Git 各平台安装包下载地址为:http://g ...

  6. 转 git安装配置

    Win7上Git安装及配置过程 一.安装说明 1.Git在windows平台上安装说明. Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件 ...

  7. Git安装配置(完整版)

    首先安装Windows客户端的git和TortoiseGit. 安装这两个软件还是蛮重要的,很多选项不能乱选. 为了写个完整的博客,我是装了又卸,卸了又装. 1.安装git 下载:https://gi ...

  8. Windows系统Git安装配置

    Git的安装 Git是一个开源的分布式的版本控制软件,是Linus Torvalds 为了方便开源贡献者协同开发和管理 Linux 内核开发替代BitKe而开发的. 打开git官网的下载地址:http ...

  9. git安装配置

    1.git 安装 sudo apt-get install git 2.配置本机git的两个重要信息,user.name和user.email git config --global user.nam ...

随机推荐

  1. MySQL数据库(2)

    上一篇我们讲述过MySQL创建数据库,数据表的内容,其中涉及到了几个约束: NOT NULL   非空约束 PRIMARY KEY   主键约束 UNIQUE KEY    唯一约束 其实还有两个约束 ...

  2. Mongoose 'static' methods vs. 'instance' methods

    statics are the methods defined on the Model. methods are defined on the document (instance). We may ...

  3. Intellij IDEA 自动清除无效 import

    打开偏好设置: 输入auto import: 注:想在以后的工程中都自动清除,可以在File中如下图操作:

  4. DBLookupCombobox实现下拉联动

    这次用DBLookupCombobox实现省份-城市-地区的下拉联动,用以学习DBLookupCombobox的一些用法 效果图: 首先建立数据表(数据表形式可以多种多样:数据库表.文本.xml等,最 ...

  5. maven项目搭建步骤

    maven项目搭建步骤 班级:软件151           姓名:黄于霞 一.准备以下压缩包 1.JDK1.7 文件:jdk1.7.rar 2. eclipse-jee-mars-2 文件:32位系 ...

  6. 复杂xml格式报文和实体类之间的转化

    pom.xml中引入如下依赖: <dependency> <groupId>org.eclipse.persistence</groupId> <artifa ...

  7. Unity3d KeyCode 键盘各种键值详情

    KeyCode :KeyCode是由Event.keyCode返回的.这些直接映射到键盘上的物理键. 值        对应键 Backspace     退格键 Delete      Delete ...

  8. 关于WCF服务 http://XXXXXX/XXX/xxx.svc不支持内容类型 application/sop+xml;charset=utf-8 错误解决方法

    有时候用IIS部署一个WCF服务时,无论是在客户端还是在服务端通过地址都能正常访问. 但是当你在客户端添加服务引用时, 怎么也添加不上, 会碰到了如下错误: 好啦. 现在说说怎么解决吧. 其实很简单. ...

  9. ubuntu google chrome 全屏显示命令

    全屏模式:kiosk默认全屏打开一个网页呢,只需要在快捷方式中加上 --kiosk [url] 就可以了.终端命令行打开: google-chrome --kiosk www.baidu.com 参考 ...

  10. 基于react的MQ管理系统遇到的问题以及解决办法

    跟一般的管理系统差不多 一.需求 1.新增申请和修改的弹窗里面的部门跟应用组改成下拉框,并调取后台接口获取到相应的值.1.1相应的代码 // 获取部门 getDepartment = () => ...