Git 快捷使用
一、Git下载配置
1.1 下载
git-scm.com
下载
1.2 解压配置
配置环境变量
验证Git环境变量是否配置好
1.3 git config
git config --global user.name "webrx"
git config --global user.email "webrx@126.com"
git config --global --list
##################################################
C:\Users\Administrator>git -v
git version 2.37.3.windows.1
C:\Users\Administrator>git config --global --list
fatal: unable to read config file 'C:/Users/Administrator/.gitconfig': No such file or directory
C:\Users\Administrator>git config --global user.name webrx
C:\Users\Administrator>git config --global user.email webrx@126.com
C:\Users\Administrator>git config --global --list
user.name=webrx
user.email=webrx@126.com
1.4 idea开发工具配置
需要安装gitee插件
二、建立项目库
2.1 init初始化
git init
git init .
git init oa
新建立一个oa项目库(文件夹,里边有一个.git)
2.2 clone
git clone gitee地址
2.3 idea init
2.4 idea clone
三、项目远程仓库管理
3.1 .gitignore和README.md
.gitignore
在项目根目录下建立一个
.gitignore
文件,此文件是忽略文件。
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
.idea
.target
out
*.iml
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
README.md
在项目根目录下建立README.md文件,此文件使用markdown语法编写,主要用于项目的文字说明。
# repo
#### 介绍
{**以下是 Gitee 平台说明,您可以替换此简介**
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
3.2 git remote
Git 全局设置:
git config --global user.name "webrx"
git config --global user.email "webrx@126.com"
创建 git 仓库:
mkdir repo
cd repo
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/webrx/repo.git
git push -u origin "master"
已有仓库?
cd existing_git_repo
git remote add origin https://gitee.com/webrx/repo.git
git push -u origin "master"
git clone
$ git clone https://www.gitee.com/webrx/wx_xmind.git
git fetch
git pull
3.3 idea
3.3.1 分享gitee.com
在idea中先安装gitee插件,还要设置一下git.exe位置,1.4小节有插图效果。