GIT 私有服務器搭建

服務器安裝與建立倉

yum install git

建立git目錄

mkdir  /var/git
cd  /var/git
mkdir play.git
cd play.git
git --bare init
Initialized empty Git repository in /var/git/test.git/

Clone 線上代碼

git clone root@110.111.120.119:/var/git/test.git

建立證書登陸

收集全部須要登陸的用戶的公鑰,就是他們本身的id_rsa.pub文件,把全部公鑰導入到/home/git/.ssh/authorized_keys文件裏,一行一個

建立密鑰

ssh-keygen -t rsa
cat .ssh/id_rsa.pub

遇到的問題

建立一個空的倉庫後,git pull/push 報錯,報錯信息以下
Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.
這是正常的,在本地目錄添加一個文件,commit 後 push 便可。git

相關文章
相關標籤/搜索