Sunday, April 27, 2014

Auto-Code Deployment on Production Servers Using GIT

sudo apt-get install git

git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git --work-tree=/var/www/ init

git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git clean -df & git checkout .

git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git pull

pulls the contents in the current directory in  which you are.

git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git --work-tree=/var/www/ pull

code is pulled in the --work-tree directory. But there is still one issue, it asks for username and password which is entered manually.

git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git config credential.helper store

To store credentials in a file on disk, by default stored at ~/.git-credentials

We can set credentials file path by following
git --git-dir=/home/ubuntu/git/oneworldbox-stb-api/.git config credential.helper store=<path>

git remote set-url origin http://username:password@gitlab.jemtv.com/oneworldbox-stb-api.git

I hope it helped. Feel free to comment...

No comments:

Post a Comment

Feel free to comment. Your comments are considered...