1. ubuntu中安装gitlab
1.1 安装git
sudo apt-get update
sudo apt upgrade
sudo apt-get install git
1.2 安装openssh
sudo apt-get install openssh-server openssh-client
1.3 添加git的用户和密码
adduser git
输入密码
可以通过以下命令修改用户,密码
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
1.4 安装成功查看
git --version
2. git clone 时候出现 Please make sure you have the correct access rights and the repository exists
原因:出现这个问题的原因是git服务器没有存储本地ssh密钥
解决:
1.先查找ubuntu本地的用户名下的密钥,在终端输入命令:
whoami
ssh-keygen -t rsa -C "username" #username为whoami的查找结果
一路回车,遇到输入y/n输入y
2.如图,查找并复制公共密钥
复制id_rsa.pub文件内容
3.登录gitlab->右上角找到用户,点击->找到Settings,进入->找到SSH Keys,在Key的下方框中粘贴复制的密钥->点击Add key即可。
4.在Ubuntu终端使用命令即可使用
git clone git@gitlab.gwm.cn:(gitlab的ssh地址)