背景:虽然有GitHub、GitLab这样强大的Git仓库,但是涉及私有Git库要收费,所以自己动手搭建免费的用用

环境:windows 7 旗舰版、JDK 1.8、IDEA 2017

-------------------------------------------------------------------------------------------------------------------------------------------

1、Gitblit服务器搭建

1.1、下载最新版本的Gitblit,Gitblit官方网站:http://www.gitblit.com/,本文使用的是1.8.0版本

1.2、下载完毕后解压至D:\Java下,改名为gitblit(只是个人习惯,Java开发相关的东西都放在这儿),观察一下gitblit的目录结构,红色箭头标记的是将要修改和操作的部分

1.3、在data目录中将defaults.properties文件复制一份,改名为my.properties

1.4、打开gitblit.properties文件,注释掉include = defaults.properties这句,添加include = my.properties这句,说明使用的是my.properties配置文件

1.5、找到server.httpPort,设定http协议的端口号: server.httpPort = 10101

1.6、找到server.httpBindInterface,设定服务器的IP地址(本机IP地址):server.httpBindInterface = 192.168.20.7

1.7、找到server.httpsBindInterface,设定为localhost:server.httpsBindInterface = localhost

1.8、在D:\Java\gitblit目录同时按下shift+鼠标右键,找到"在此处打开命令窗口",输入gitblit.cmd

1.9、打开浏览器,在地址栏输入:https://localhost:8443/ 或 http://192.168.20.7:10101/,如果出现下图,说明服务器已经搭建完毕。默认账号和密码均为 admin

-------------------------------------------------------------------------------------------------------------------------------------------

2、gitblit创建用户、版本库,并分配访问权限

2.1、使用admin账号登录服务器,创建用户,并分配访问权限

2.2、创建版本库,并设置版本库访问权限

点击"保存"按钮后,再用创建的temptation账号登录Git服务器观察一下,发现可以看到admin账号创建并分配给temptation账号访问的版本库

-------------------------------------------------------------------------------------------------------------------------------------------

3、Git客户端搭建

3.1、下载Git客户端最新版本,Git客户端官网:https://git-scm.com/downloads,下载完毕后打开,一路回车默认安装即可

3.2、Git本机配置,找到安装好的Git客户端,点击Git Bash

命令语句解释:

cd ~/.ssh:查看是否存在.ssh目录

mkdir ~/.ssh:如果不存在,则创建一个.ssh目录

git config --global user.name "账号":设置git全局账号

git config --global user.email "邮箱":设置git全局邮箱

ssh-keygen -t rsa -C "邮箱":生成SSH Key

3.3、在操作系统的用户目录下C:\Users\temptation\.ssh下,找到id_rsa.pub,将其中的内容复制出来

3.4、用创建的Git账号temptation登录Git服务器

3.5、将id_rsa.pub的内容贴到SSH Keys中,点击"添加"即可

-------------------------------------------------------------------------------------------------------------------------------------------

4、Git客户端使用

4.1、在想要创建项目的路径创建项目目录,比如:在D:\workspace下新建目录studygit

4.2、在目录studygit下,右键找到"Git Bash Here",将下图红色箭头标记部分复制贴入

4.3、再次刷新服务端,可以看到版本的提交

-------------------------------------------------------------------------------------------------------------------------------------------

5、IDEA整合Git使用(整合使用Maven管理的Springboot项目为例)

5.1、IDEA的Settings中设置Git的SSH executable为Native

5.2、打开上面创建的Git项目

5.3、在项目上右键,点击"Add Framework Support...",选中Maven

5.4、IDEA的Settings中设置Maven为自己配置的Maven(Maven设置可以参看:https://www.cnblogs.com/iflytek/p/8526182.html

5.5、在pom.xml文件中编写如下内容

 <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>cn.temptation</groupId>
<artifactId>studygit</artifactId>
<version>1.0-SNAPSHOT</version> <!-- 使用spring boot的默认设置 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent> <dependencies>
<!-- web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
</project>

5.6、在项目上使用快捷键F4,查看Problem并解决

5.7、编写Springboot项目内容(可以参看:https://www.cnblogs.com/iflytek/p/8526182.html

 package cn.temptation;

 import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class Application {
public static void main(String[] args) {
// SpringBoot项目启动
SpringApplication.run(Application.class, args);
}
}

5.8、提交代码至Git服务器

-------------------------------------------------------------------------------------------------------------------------------------------

6、IDEA中直接使用已经创建好的Git项目

【原】无脑操作:Gitblit服务器搭建及IDEA整合Git使用的更多相关文章

  1. 3-Gitblit服务器搭建及IDEA整合Git使用

    背景:虽然有GitHub.GitLab这样强大的Git仓库,但是涉及私有Git库要收费,所以自己动手搭建免费的用用 环境:windows 7 旗舰版.JDK 1.8.IDEA 2017 ------- ...

  2. 【原】无脑操作:EasyUI Tree实现左键只选择叶子节点、右键浮动菜单实现增删改

    Easyui中的Tree组件使用频率颇高,经常遇到的需求如下: 1.在树形结构上,只有叶子节点才能被选中,其他节点不能被选中: 2.在叶子节点上右键出现浮动菜单实现新增.删除.修改操作: 3.在非叶子 ...

  3. 【原】无脑操作:express + MySQL 实现CRUD

    基于node.js的web开发框架express简单方便,很多项目中都在使用.这里结合MySQL数据库,实现最简单的CRUD操作. 开发环境: IDE:WebStorm DB:MySQL ------ ...

  4. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础授权权限

    上一篇<[原]无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限>介绍了实现Shiro的基础认证.本篇谈谈实现 ...

  5. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限

    开发环境搭建参见<[原]无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页> 需求: ① 除了登录页面,在地址栏直接访问其他 ...

  6. CAS5.3服务器搭建与客户端整合SpringBoot以及踩坑笔记

    CAS5.3服务器搭建与客户端整合SpringBoot以及踩坑笔记 cas服务器的搭建 导出证书(1和2步骤是找了课程,随便写了一下存记录,不过对于自己测试不投入使用应该不影响) C:\Users\D ...

  7. 【原】无脑操作:eclipse + maven搭建SSM框架

    网上看到一些Spring + Spring MVC + MyBatis框架的搭建教程,不是很详细或是时间久远了,自己动手整一个简单无脑的! 0.系统环境 1)Windows 10 企业版 2)JDK ...

  8. 【原】无脑操作:ElasticSearch学习笔记(01)

    开篇来自于经典的“保安的哲学三问”(你是谁,在哪儿,要干嘛) 问题一.ElasticSearch是什么?有什么用处? 答:截至2018年12月28日,从ElasticSearch官网(https:// ...

  9. git服务器搭建及eclipse使用git

    一.搭建git服务器 1.yum install git 2.新建用户linux用户git,管理git服务 useradd git passwd git 3.初始化git仓库 git init --b ...

随机推荐

  1. PAT1029:Median

    1029. Median (25) 时间限制 1000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given an incr ...

  2. Pat1071: Speech Patterns

    1071. Speech Patterns (25) 时间限制 300 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming Peo ...

  3. zookeeper应用场景-java

    声明,本文是复制别人的文章,感觉还行,原文:http://www.cnblogs.com/xymqx/p/4465610.html 本人热爱技术,跪求有好的技术文章希望大家多多分享,谢谢.... Zo ...

  4. elasticSearch+spring 整合 maven依赖详解

    摘自:http://www.mayou18.com/detail/nTxPQSyu.html [Elasticsearch基础]elasticSearch+spring 整合 maven依赖详解 Ma ...

  5. SSM-SpringMVC-32:SpringMVC中灌顶传授文件上传

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 我将用自认为最简单的语言,描述Springmvc的文件上传,来将老夫毕生功力灌顶传授给你 首先文件上传,又简至 ...

  6. swap分析及其使用

    什么是swap swap主要是在内存不够用的时候,将部分内存上的数据交换到swap空间上,以便让系统不会因为内存不够用而导致oom或者更致命的情况出现.当内存使用存在压力的时候,开始触发内存回收行为, ...

  7. tkinter中entry输入控件(四)

    entry控件 import tkinter wuya = tkinter.Tk() wuya.title("wuya") wuya.geometry("300x200+ ...

  8. LeetCode Javascript实现 169. Majority Element 217. Contains Duplicate(两个对象比较是否相等时,如果都指向同一个对象,a==b才是true)350. Intersection of Two Arrays II

    169. Majority Element /** * @param {number[]} nums * @return {number} */ var majorityElement = funct ...

  9. 今天读一读七天学会NodeJS

    七天学会NODEJS NodeJS基础 小结 本章介绍了有关NodeJS的基本概念和使用方法,总结起来有以下知识点: NodeJS是一个JS脚本解析器,任何操作系统下安装NodeJS本质上做的事情都是 ...

  10. windows 搭建 IBM Hyperledger Fabric(超级账本)开发环境

    一.概述 Hyperledge fabric项目是IBM开源的区块链项目.Github地址:https://github.com/hyperledger/fabric 想对fabric有具体的认识,可 ...