Create user for using git :
Open putty with root user then create user :
To create a new user // $ sudo add user username
Then // $su username
Then use // $ cd
Create ssh public key // $ mkdir .ssh
go to home directory then go into your user name folder find .ssh folder go into .ssh folder find ‘id_rsa.pub’ move this file into tmp directory with ‘id_rsa.username.pub’ name
You just append them to your authorized_keys file: // $ cat /tmp/id_rsa.username.pub >> ~/.ssh/authorized_keys
{to use this command your public key is a authorized keys}
Now your user is ready for using git
create git repository :
create directory anywhere on your server // mkdir httpdocs && cd httpdocs
initialize git into directory //$ git init
back to a directory //$ cd ../
The following three commands are the black magic for getting a remote git repo setup:
$ git clone –bare httpdocs httpdocs.git
$ mv httpdocs httpdocs.backup
$ git clone httpdocs.git
// then given 777 permission to all folder created by git for this repository
// then given permission to user for access and create that folder using command
$ sudo chown -R username directory
Local set-up (push commits)
$ git add * // for adding new file
$ git commit -m ‘Start of new project’
$ git push origin master
local (pull commits)
$ cd ../
$ cd www/…./httpdocs/
$ git fetch
$ git diff origin/master
$ git merge origin/master
Recent Comments