Windows 下用 gogs 配置局域網 git server

最近要用 C# 開發一個新的項目,因此須要在 Windows 局域網環境下構建一個 git server。html

在 Windows 7 上搭建 git server 的方案不少。好比:git

1. gogsgithub

2. bamboo(https://www.atlassian.com/software/bamboo/)數據庫

3. Github for Windows + CoqSSH(https://github.com/msysgit/msysgit/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-CopSSH)windows

git stash 太龐大,不作考證。瀏覽器

這裏選 gogs 實現。app

 

平臺:Win7 x64
工具:nssm、gogs_v0.8.43_windows_amd64.zip、MySQL、git 工具

0. 安裝 MySQL;
1. 在 MySQL 中建立 gogs 數據庫:
   create database gogs;
2. 安裝 Git 工具。這一步是爲了 gogs 服務端可以找到 git 命令。因爲此前我在機器上已經安裝了 Github for Windows 工具,因此 git 也附帶的安裝了。若是你的機器上沒安裝 git。能夠去下載一個並安裝。
3. 解壓 gogs_v0.8.43_windows_amd64.zip 到目的位置;
4. 註冊 gogs 服務:
   (1) 修改 gogs/scripts/windows/install-as-service.bat,將其中的:
       SET gogspath=C:/gogs
       路徑信息修改成本機 gogs 安裝路徑;
   (2) 安裝 nssm,並確保 nssm 的安裝路徑已添加到 %PATH% 環境變量中;
   (3) 以管理員權限運行 install-as-service.bat;
5. 打開瀏覽器,輸入:127.0.1.1:3000,進入配置界面(我只修改了代碼倉庫存放路徑這一項)。完成配置後,gogs/custom/conf 目錄下會生成一個新的 app.ini 配置文件。
6. 註冊用戶,登陸用戶。默認狀況下,註冊的第一個用戶將具備管理員權限。
7. 在局域網狀況下,Garvatar 不可用。因此用戶最好設置一個自定義頭像。
8. 在工做機器上安裝一個 git 客戶端工具。可選的帶 GUI 的客戶端工具備:工具

   SourceTree
   TortoiseGitspa

 

參考資料:server

1. https://gogs.io/docs/installation/install_from_binary.html

2. https://gogs.io/docs/installation/configuration_and_run

3. https://gogs.io/docs/installation/run_as_windows_service

4. https://gogs.io/docs/advanced/configuration_cheat_sheet.html

相關文章
相關標籤/搜索