Create local repository and add UX-CMS as remote repository:
git init && git remote add framework https://github.com/Ator9/UX-CMS.git && git pull framework master
sudo -u web3 git init --bare
sudo -u web3 git remote add origin git@bitbucket.org:xxx/yyy.git
sudo chown -R xxx:yyy .
sudo -u web3 ssh-keygen
sudo -u web3 git --work-tree=/var/www/domain/web --git-dir=/var/www/domain/private pull origin master
sudo -u web3 git --work-tree=/var/www/domain/web --git-dir=/var/www/domain/private checkout -f
Git "config" file example:
[credential "https://bitbucket.org"]
helper = store --file /var/www/domain/web/includes/.git-credentials
.git-credentials example:
https://user:pass@bitbucket.org
Create online repository and setup the hook:
git init --bare && touch hooks/post-receive && chmod +x hooks/post-receive
printf '#!/bin/sh'"\ngit --work-tree=/var/www --git-dir=$(pwd) checkout -f" >> hooks/post-receive
nano hooks/post-receive
git remote add online gituser@server.com:/var/project/barerepo
git push online master
Client Setup. Create "gitkey" ssh key and set "config" file at ~/.ssh:
ssh-keygen
nano config
Host serverCom
HostName server.com
User gituser
IdentityFile ~/.ssh/gitkey
git remote add online serverCom:/var/www/barerepo/private
git push online master
Server Setup. Create git user and set client public ssh key ("gitkey.pub"):
sudo adduser gituser
mkdir /home/gituser/.ssh
echo "client_public_ssh_key" >> /home/gituser/.ssh/authorized_keys