Git ad-hoc sharing of repository

Try Fast Read
0
0



Initially in your server computer(computer having git repo) say A, edit your gitconfig file
vi ~/.gitconfig
add the following
[alias]
serve = !git daemon –reuseaddr –verbose –base-path=. –export-all –enable=receive-pack ./.git

save it. now determine your computer’s ip-address via
ifconfig
to enable push run the following command
git config receive.denyCurrentBranch ignore
note the ip address of your computer and run git serve by typing
git serve
now in another computer SAY B, you can clone the repo using following command
git clone git://YOUR_IP_ADDRESS/ directory_to_add_repo_to
now you have cloned the repo
make edit, add, commit, pull and push, after the push operation you can close the connection in computer A by pressing [ctrl]+c
now you need to run git hard reset to see the changes in computer A, to do that run
git reset –hard
Now you can see the changes merged

Note: –hard Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.

Post navigation