3-Gitblit服务器搭建及IDEA整合Git使用
背景:虽然有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文件中编写如下内容

1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 <modelVersion>4.0.0</modelVersion>
6
7 <groupId>cn.temptation</groupId>
8 <artifactId>studygit</artifactId>
9 <version>1.0-SNAPSHOT</version>
10
11 <!-- 使用spring boot的默认设置 -->
12 <parent>
13 <groupId>org.springframework.boot</groupId>
14 <artifactId>spring-boot-starter-parent</artifactId>
15 <version>2.0.4.RELEASE</version>
16 </parent>
17
18 <dependencies>
19 <!-- web -->
20 <dependency>
21 <groupId>org.springframework.boot</groupId>
22 <artifactId>spring-boot-starter-web</artifactId>
23 </dependency>
24 <!-- thymeleaf -->
25 <dependency>
26 <groupId>org.springframework.boot</groupId>
27 <artifactId>spring-boot-starter-thymeleaf</artifactId>
28 </dependency>
29 </dependencies>
30 </project>

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


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

1 package cn.temptation;
2
3 import org.springframework.boot.SpringApplication;
4 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
6 @SpringBootApplication
7 public class Application {
8 public static void main(String[] args) {
9 // SpringBoot项目启动
10 SpringApplication.run(Application.class, args);
11 }
12 }

5.8、提交代码至Git服务器







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



3-Gitblit服务器搭建及IDEA整合Git使用的更多相关文章
- 【原】无脑操作:Gitblit服务器搭建及IDEA整合Git使用
背景:虽然有GitHub.GitLab这样强大的Git仓库,但是涉及私有Git库要收费,所以自己动手搭建免费的用用 环境:windows 7 旗舰版.JDK 1.8.IDEA 2017 ------- ...
- CAS5.3服务器搭建与客户端整合SpringBoot以及踩坑笔记
CAS5.3服务器搭建与客户端整合SpringBoot以及踩坑笔记 cas服务器的搭建 导出证书(1和2步骤是找了课程,随便写了一下存记录,不过对于自己测试不投入使用应该不影响) C:\Users\D ...
- solr服务器搭建与Tomact整合及使用
一:solr服务器的搭建 1:搭建全新的为solr专用的solr服务器: 在自己电脑上搭建两台Tomact服务器,一台仍为应用服务器,一台作为solr服务器,应用服务器按照正常Tomact服务器搭建即 ...
- git服务器搭建及eclipse使用git
一.搭建git服务器 1.yum install git 2.新建用户linux用户git,管理git服务 useradd git passwd git 3.初始化git仓库 git init --b ...
- 局域网git服务器搭建(基于win7 + bonobo git server)
公司内网有一台win7系统的服务器. 准备在上面部署git后台, 用于内网项目版本管理. 搜索了相关资料后, 在根据公司环境, 决定采用win7 + bonobo git server + git的方 ...
- CAS5.3服务器搭建及SpringBoot整合CAS实现单点登录
1.1 什么是单点登录 单点登录(Single Sign On),简称为 SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的 ...
- Windows平台下Git(gitblit)服务器搭建
环境:Windows 10 专业版32位 因为公司服务器上已经搭了Visual SVN等,只好在Windows上搭个Git Server给大家用. 参考链接:http://www.cnblogs.co ...
- Windows平台下Git服务器搭建--------gitblit
Windows(server)平台下Git服务器搭建 第一步:下载Java,安装,配置环境变量. 第二步:下载Gitblit.下载地址:http://www.gitblit.com/ 第三步:解压缩下 ...
- 【转】Windows平台下Git服务器搭建
Windows平台下Git服务器搭建 Posted on 2015-05-18 21:29 阿祥当码农 阅读(7637) 评论(0) 编辑 收藏 该文章转自:http://www.codeceo.co ...
随机推荐
- 【转帖】大话Spring Cloud
springcloud(一):大话Spring Cloud 2017/05/01 http://www.ityouknow.com/springcloud/2017/05/01/simple-sp ...
- Almost Sorted Array(o(nlgn)求解LIS)
Almost Sorted Array Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Ot ...
- webelement类的方法
webelement类的方法,常用的汇总如下: clear()清空 例如登录时先清空输入框中的内容 driver.find_element_by_id('username').clear() clic ...
- 04、DAT图像文件
DAT是芯片的原始扫描图像,如下图: 注:这两张图来自<Bayesian Inference for Gene Expression and Proteomics>.A是U95Av2芯片的 ...
- 下载MySQL的rpm包安装MySQL
cd /usr/local/src wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.27-1.el ...
- 084、Prometheus 到底NB在哪里?(2019-05-06 周一)
参考https://www.cnblogs.com/CloudMan6/p/7709970.html 本节学习Prometheus的核心,多维数据模型 比如要监控容器 webapp1 的内存使 ...
- 76. Minimum Window Substring (JAVA)
Given a string S and a string T, find the minimum window in S which will contain all the characters ...
- softmax+交叉熵
1 softmax函数 softmax函数的定义为 $$softmax(x)=\frac{e^{x_i}}{\sum_j e^{x_j}} \tag{1}$$ softmax函数的特点有 函数值在[0 ...
- ARIMA模型
ARIMA模型(英语:Autoregressive Integrated Moving Average model),差分整合移动平均自回归模型,又称整合移动平均自回归模型(移动也可称作滑动),时间序 ...
- passwd 修改用户密码 / chpasswd 批量更新用户密码
passwd 修改用户密码 1.命令功能 passwd 修改用户密码及密码过期时间等信息. 2.语法格式 passwd option username passwd 选项 用户名 选项说明 ...