Author Archives: admin

Deploy website via Git

On your server

~/www$ git init
Initialized empty Git repository in /home/example.com/www/.git/

Enable current branch rewrite, cause with are using non-bare repo:

~/www$ git config receive.denyCurrentBranch ignore

Create hook .git/hooks/post-receive and write into it:

#!/bin/sh
cd ..
GIT_DIR='.git'
git reset --hard

Make your hook executive:

~/www$ chmod +x .git/hooks/post-receive

On developer machine

Create repo, add all needed files to it, make your first commit.

git init
git config --local user.name "Developer Name"
git config --local user.email "developer@company.com"
git add <some_files>
git commit -m 'initial commit'

Now add remote repository as origin:

git remote add origin user@example.com:~/www/
git push --set-upstream origin master

How to work with repository?

After you have changed some files you should add them to commit and send this commit to repository.

git commit -am 'some commit message describes accepted changes'
git push

Security

Make sure that your .htaccess file blocks access to .git/ and .gitignore. To prevent access put the following lines to your .htaccess:

# Prevents access to dot files (.git, .htaccess) - security.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

What if I change files directly on server?

All uncommited file changes on server will be ignored after git push from developer machine. If you still want to change files directly on server you should use another two hooks:
.git/hooks/pre-receive

#!/bin/sh
cd ..
GIT_DIR='.git'
git stash save --quiet
git stash show || true

.git/hooks/post-receive

#!/bin/sh
cd ..
GIT_DIR='.git'
git reset --hard
git stash pop --quiet || git reset --hard

Update kernel on Ubuntu

To update your kernel version run the following commands in your terminal:

sudo add-apt-repository ppa:kernel-ppa/ppa
sudo apt-get update
apt-cache showpkg linux-headers

You will see the list of available kernels. Choose the kernel version you want and run:

sudo apt-get install linux-headers-3.8.0-26 linux-headers-3.8.0-26-generic linux-image-3.8.0-26-generic --fix-missing

Enter ssh password once

Everytime you establish ssh-connection or use git via ssh you will be asked for a password. I suggest to you a simple solution of that issue. Before connecting to remote machine run the following commands in your terminal:

ssh-agent bash
ssh-add /home/$USER/.ssh/id_rsa

Install 1C:Enterprise 8.2 using Wine on Ubuntu

Install and configure wine

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine winetricks
winetricks settings fontsmooth=rgb
winetricks ie8 gdiplus

Run winecfg and check that all needed libraries presist:
*comctl32
*gdiplus
*iexlorer.exe
*itircl
*itss
*jscript
*msctf
*mshtml
*shdoclc
*shdocvw
*shlwapi
*updspapi
*urlmon
*xmllite

Install and run 1C:Enterprise

wine setup.exe
wine ~/.wine/drive_c/Program Files (x86)/1cv82/common/1cestart.exe