七叶笔记 » golang编程 » windows下安装gogs

windows下安装gogs

关于gogs

能够项 github 一样的创建仓库做团队协助。 对比了几个git-server。 gitlab gogs gitblit这几个工具。 gogs最适合。国人开发功能齐全。最关键的是跨平台。github上开源。golang编写。

工具软件准备

  • 下载windows_amd64.zip
  • 下载 nssm
  • https:// git -for-windows.github.io/ 下载msggit
  • 下载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 状态
 
  • 具体的使用方法:
  • 安装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. :: :: 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: :: :: 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所在目录)。

  1. 管理员身份执行脚本
  2. 脚本提示成功就ok了,如果提示失败。根据提示处理就ok。 无非是nssm remove gogs 重新来一遍。
  3. 执行gogs安装。
  4. 进入后进行一系列的配置。 主要就是数据库和管理员两项配置。 快速使用的话建议使用sqllite。
  5. 打开网址注册一个账号
  6. 添加一个仓库 创建一个个人仓库或者创建组织在组织下添加一个仓库。组织是为了工号的授权管理。
  7. 正常情况下重启电脑后gogs会自动运行。
  8. 经过以上的步骤一个git server算是完成了。gogs的使用帮助
  9. 安装git客户端
  10. 安装msggit
  11. 注意的点就是勾选中windows cmd设置,使用windows的console.
  12. 安装tortoisegit
  13. 注意的点是使用ssh方式选项和几个cmd添加选项。正常情况下安装完成之后就让你填写一个用户名密码。就填写在gogs上注册的用户名和密码。
  14. 使用仓库 先用http的方式吧。git clone (gogs上仓库地址)
  15. 记下来就一些使用的问题。

常见问题

  1. gogs 使用ssh方式clone 主要问题是windows ssh server很不好用。我选择http.
  2. 如何使用ssh 添加秘钥的时候注意一个点就是里面不能存在换行。

相关文章