I'm not really sure what you're asking. You say you want to host on your own server but your question says you want to host like gitlab pages which is not your own server.
In any case maybe this will help
This is what I do
on local pc
mkdir folderforwebsite
cd folderforwebsite
git init
echo "hello world" > index.html
git add index.html
git commit -m "initial commit"
I now have a repo locally. Copy it to the server
scp -r ../folderforwebsite [email protected]:/path/from/root/to/webfolder
Now I have it on the remote server.
ssh [email protected] 'cd path/to/webfolder; git checkout -b live`
Now there's both a master and live branch on the website. I do this since AFAICT you can't push to the current branch. So now we have a "live" branch which is current on the remote and a "master" branch which is not
Finally add a remote to my local repo
git remote add web ssh://[email protected]/path/from/root/to/webfolder
Now, anytime I want to update the website I check stuff into my local master branch and then run this script
#!/bin/sh
set -e
set -v
git push web master
ssh [email protected] git merge --ff-only master
The git push
pushes my changes to the non-current branch on the webserver. The ssh
then logs into the webserver and fast-forwards the changes in "master" to the current branch. In this case the "live" branch.
--ff-only
says to fail if there are changes on the server.
If there are changes on the server I can pull them into my local master with
git pull web live
On more thing. Before I do any of this I setup SSH keys on the remote server so I don't have to type any passwords
This has absolutely no connection to github or gitlab. I might push my changes there as well but they're not connected.