how to use git clone for two developers
I use git for my local project in Linux where I’m only one person. I would like to share my project with other person who is on the another machine using Windows. How could I do that?
I have a book about git but still could not figure out how to handle that. For example, it says that the other user could type:
git clone my.ip.add.ress:/home/myuser/projects/myproject
But when this person does it, it asks password for his user in my machine. I did not register any other users on my machine except myself. Of course I can:
- Register new user in my linux (
- Create link in user directory to my project
- Configure permissions for my project’s folder to be readeable for this user
and then this user (developer2) could perform command like:
but I guess it’s not a nice solution.
2 Solutions collect form web for “how to use git clone for two developers”
The simplest way of doing that is to use file system based access.
I.e. your second developer can do:
git clone /home/users/developer1/repos/project
In this case he will not be able to push to your repository but if he can read he will be able to establish the connection and pull from you. when he will contribute his part – you will pull from him
git remote add dev2 /home/users/developer2/repos/project git fetch dev2
and so on…
second variant is to run git-daemon
/usr/local/git/bin/git daemon --reuseaddr --export-all --base-path=/home/users/dev1/repos
You can use
--enable=receive-pack to give him an ability to push to your repo if needed. This is not recommended in open network or on public repos, but inside firewalled network it is totally fine i think
- start git-daemon to share your repository
- have the other guy do
git clone git://your.ip.address/your-project
He won’t need to authenticate to git-daemon.
Here’s a link to how it’s done (and seven other ways to do it).