安装
安装一:docker
docker pull gogs/gogs
docker run -id --name=gogs -p 1999:3000 -p 1998:22 -v $PWD/data:/data gogs/gogs
安装二:下载解压
这是我之前下载的一个最新版本,直接解压安装
解压后进入,运行./gogs web
,然后浏览器访问即可出现安装界面
访问
浏览器访问ip:1999,具体配置如下:
数据库选选sqlite,不用配置.域名填写自己服务器ip,端口填写自己相应开放的映射端口
应用url如 http://182.92.200.149:1999/.下来就是管理员设置,可选填
创建仓库
push
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git init
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# ls -a
. .. .git
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git config user.name 安然
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git config user.email Anran@git.com
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# vim README.md
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# cat README.md
____ ___.__ ____ ___.__
\ \/ /|__|____ ____\ \/ /|__| ____
\ / | \__ \ / _ \\ / | |/ \
/ \ | |/ __ \( <_> ) \ | | | \
/___/\ \|__(____ /\____/___/\ \|__|___| /
\_/ \/ \_/ \/
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git add README.md
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git commit -m "first commit" README.md
[master (root-commit) 5f45361] first commit
1 file changed, 6 insertions(+)
create mode 100644 README.md
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git remote add gogs_http http://182.92.200.149:1999/XiaoXin/flower.git
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git remote -v
gogs_http http://182.92.200.149:1999/XiaoXin/flower.git (fetch![在这里插入图片描述](https://img-blog.csdnimg.cn/20200316061636572.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzNjE1OTAz,size_16,color_FFFFFF,t_70))
gogs_http http://182.92.200.149:1999/XiaoXin/flower.git (push)
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower# git push gogs_http master
Username for 'http://182.92.200.149:1999': XiaoXin
Password for 'http://XiaoXin@182.92.200.149:1999':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 319 bytes | 319.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://182.92.200.149:1999/XiaoXin/flower.git
* [new branch] master -> master
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/flower#
clone
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet# mkdir bud
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet# cd bud/
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud# ls -a
. ..
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud# git clone http://182.92.200.149:1999/XiaoXin/flower.git
Cloning into 'flower'...
Username for 'http://182.92.200.149:1999': XiaoXin
Password for 'http://XiaoXin@182.92.200.149:1999':
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud# ls
flower
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud# cd flower/
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud/flower# ls -a
. .. .git README.md
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud/flower# cat README.md
____ ___.__ ____ ___.__
\ \/ /|__|____ ____\ \/ /|__| ____
\ / | \__ \ / _ \\ / | |/ \
/ \ | |/ __ \( <_> ) \ | | | \
/___/\ \|__(____ /\____/___/\ \|__|___| /
\_/ \/ \_/ \/
root@xiaoxin-Inspiron-5567:/usr/local/gitrepo-tet/bud/flower#
ssh秘钥
ssh-keygen -t rsa -C "你的email地址"
cd /root/.ssh/
ls
id_rsa id_rsa.pub known_hosts
cat id_rsa.pub