On server side
[user@test_server ~]$ git daemon --base-path=/var/www/html --reuseaddr --export-all --verbose --enable=receive-pack
Do not close the terminal on server.
--base-path=/var/www/html
is path to your repository.On developer side
[developer@dev_machine:~]$ mkdir repo [developer@dev_machine:~]$ cd repo/ [developer@dev_machine:~/repo]$ git clone git://10.13.13.101/ project_folder Initialized empty Git repository in /home/developer/repo/project_folder/.git/ remote: Counting objects: 9, done. remote: Compressing objects: 100% (4/4), done. remote: Total 9 (delta 1), reused 0 (delta 0) Receiving objects: 100% (9/9), done. Resolving deltas: 100% (1/1), done. [developer@dev_machine:~/repo]$ cd project_folder/ [developer@dev_machine:~/repo/project_folder] (master)$
Once you are in
project_folder
you can push and pull to/from remote repository like this[developer@dev_machine:~]$ git push git://10.13.13.101/ master:dev_mike
Or if you use SSH
[developer@dev_machine:~]$ git push ssh://user_name@10.13.13.101/var/www/html master:dev_mike user_name@10.13.13.101's password: or Enter passphrase:
To start git daemon automatically when you login on the server do this:
[user@test_server ~]$ mkdir scripts [user@test_server ~]$ cd scripts
Place the two following files in this folder
file:run_git_daemon:
#!/bin/bash # chkconfig: 2345 20 80 gnome-terminal --working-directory="/home/user_name/scripts" --command="/home/user_name/scripts/git_server.sh" exit 0
file:git_server.sh
#!/bin/bash # run git daemon git daemon --reuseaddr --base-path=/var/www/html --export-all --verbose --enable=receive-packSave files. Have your system administrator to place file run_git_daemon in auto start folder. Which folder? It depends of Linux distro.
Git server output in terminal window |
No comments:
Post a Comment