您的位置:首页 > 编程语言 > Go语言

windows下安装gogs

2017-02-06 18:11 204 查看

关于gogs

能够项github一样的创建仓库做团队协助。

对比了几个git-server。 gitlab gogs gitblit这几个工具。

gogs最适合。国人开发功能齐全。最关键的是跨平台。github上开源。golang编写。

工具软件准备

 https://github.com/gogits/gogs/releases 下载windows_amd64.zip

 http://nssm.cc/download 下载 nssm

 https://git-for-windows.github.io/ 下载msggit

 https://tortoisegit.org/ 下载tortoisegit

gogit 类似github的工具

nssm 是为了gogit能够以windows服务已经运行

msgit 和小乌龟是git的客户端。

服务端搭建

nssm工具

nssm工具目录添加环境变量。其主要的命令如下:

nssm install servername  安装
nssm remove  servername  移除
nssm start   servername  开启
nssm stop    servermame  停止
nssm restart servername  重启
nssm status  servername  状态


具体的使用方法:http://nssm.cc/usage

安装gogs

编辑运行脚本

脚本如下:
script/window/install-as-service.bat


@ECHO off

:: This script relies on nssm.exe to work.
:: Please, download it and make it available on the system path,
:: or copy it to the gogs path.
:: https://nssm.cc/download :: This script itself should run in the gogs path, too.
:: In case of startup failure, please read carefully the log file.
:: Make sure Gogs work running manually with "gogs web" before running
:: this script.
:: And, please, read carefully the installation docs first:
:: http://gogs.io/docs/installation :: To unistall the service, run "nssm remove gogs" and restart Windows.

:: Set the folder where you extracted Gogs. Omit the last slash.
SET gogspath=C:\Users\Administrator\Desktop\git-server\gogs

nssm install gogs "%gogspath%\gogs.exe"
nssm set gogs AppParameters "web"
nssm set gogs Description "A painless self-hosted Git service."
nssm set gogs DisplayName "Gogs - Go Git Service"
nssm set gogs Start SERVICE_DELAYED_AUTO_START
nssm set gogs AppStdout "%gogspath%\gogs.log"
nssm start gogs
pause


修改gogspath,这个是gogs解压后的目录(gogs.exe所在目录)。

2. 管理员身份执行脚本

脚本提示成功就ok了,如果提示失败。根据提示处理就ok。

无非是
nssm remove gogs
重新来一遍。

3. 执行gogs安装。

http://137.0.0.1:3000 进入后进行一系列的配置。

主要就是数据库和管理员两项配置。 快速使用的话建议使用sqllite。

4. 打开网址注册一个账号

5. 添加一个仓库

创建一个个人仓库或者创建组织在组织下添加一个仓库。组织是为了工号的授权管理。

6. 正常情况下重启电脑后gogs会自动运行。

经过以上的步骤一个git server算是完成了。gogs的使用帮助 https://gogs.io/

安装git客户端

安装msggit

注意的点就是勾选中windows cmd设置,使用windows的console.

安装tortoisegit

注意的点是使用ssh方式选项和几个cmd添加选项。正常情况下安装完成之后就让你填写一个用户名密码。就填写在gogs上注册的用户名和密码。

使用仓库

先用http的方式吧。git clone http://xxxxxxx (gogs上仓库地址)

记下来就一些使用的问题。

常见问题

gogs 使用ssh方式clone

主要问题是windows ssh server很不好用。我选择http.

如何使用ssh

https://discuss.gogs.io/t/how-to-config-ssh-settings/34

添加秘钥的时候注意一个点就是里面不能存在换行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: