# 自架Git Server Ubuntu 透過ssh方式 ```shell= sudo apt-get update sudo apt-get upgrade sudo apt-get install openssh-server sudo service ssh restart # 安裝 git sudo apt-get install git-core # 新增專用群組 gitgroup sudo groupadd gitgroup # 新增 gituser 並指定成 gitgroup & 設定密碼 sudo useradd -s /bin/bash -g gitgroup -m -d /home/gituser gituser sudo passwd gituser # 建立 git repository資料位置 sudo mkdir -p /opt/gitRepository # 變更擁有者,主要是為了指定群組 sudo chown gituser:gitgroup -R /opt/gitRepository sudo chgrp -R gitgroup /opt/gitRepository #切換到 gituser 帳號 # 建立專案資料夾並初始化 cd /opt/gitRepository mkdir project_name.git cd project_name.git git init --bare --shared #推送本地專案到遠端倉庫 git remote add origin gituser@localhost:/opt/gitRepository/project_name.git git push -u origin master ``` 自架gogs https://www.tpisoftware.com/tpu/articleDetails/1428 https://www.itread01.com/content/1547140384.html 資料來源: [Ubuntu架設GitServer](http://samchu.logdown.com/posts/777348-set-up-ubuntu-gitserver) [Ubuntu Linux 上安裝並設定私有 git server 筆記 ](http://rexxoncoding.blogspot.com/2015/03/ubuntu-linux-git-server.html) [Ubuntu Git Server 架設](http://yipuchen.blogspot.com/2016/07/ubuntu-git-server.html) ###### tags: `git server` `gogs`