Linux版本:CentOS 6.5 64位
Gogs:类似Github的开源文件/代码管理系统(基于Git)
mkdir repo
此步结束后所在目录树形结构,其中repo下应为空,gogs下可能无部分文件,在初次配置后会自动生成
[root@localhost gogs]# tree -L 2
.
├── gogs
│ ├── custom
│ ├── data
│ ├── gogs
│ ├── LICENSE
│ ├── log
│ ├── nohup.out
│ ├── public
│ ├── README.md
│ ├── README_ZH.md
│ ├── scripts
│ └── templates
└── repo
├── git
├── root
└── test
3.4 创建用户(可不创建,但Gogs推荐使用git用户)
useradd git
3.5 授权
chown -R git:git /usr/local/gogs
3.6 启动gogs
cat /usr/local/gogs/gogs
nohup ./gogs web &
3.7 登陆 服务器ip:3000 进行配置
如 192.168.10.128:3000
4.安装配置及使用过程中遇到的问题
问题:
解压Gogs进入安装目录执行./gogs web时出错
提示:
-bash: ./gogs: cannot execute binary file
原因:
编译环境不同,下载的压缩包与当前系统的硬件编译环境存在差异导致内核匹配不了CPU。重新下载对应的压缩包安装即可
问题:
使用git push推送到远程库失败
提示信息:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
原因:
ssh key过期或缺失。重新创建ssh key
ssh-keygen #一切默认
eval $(ssh-agent -s) #确认ssh-agent在运行
ssh-add ~/.ssh/id_rsa #添加ssh key至ssh-agent
ssh key存储在~/.ssh/id_rsa.pub,将其中所有内容拷贝到GitHub网站的ssh key中,
位于右上your profile的edit profile的SSH and GPG keys中
提示信息:
error: failed to push some refs to 'git@github.com:Coding-Learning/testgit.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details
原因:
远程库中有文件未下载,需要先git pull origin master