tags:

views:

72

answers:

2

I am new with git.

I have a project on git. I would like someone else to get the repository, make changes and check their changes back into the repository.

Before that I would like to do this from a different machine that I have

what is the procedure to do this?

should the repository be cloned on the machine?

+2  A: 

Commits in git are always done in a local clone of a repository. The idiomatic way to share changes in git is to git pull from a remote repository to "pull in" any changes.

For example, you can clone Linus Torvalds' linux kernel repository by doing

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Then, you could regularly pull in new changes by doing

git pull

The repository is omitted here in the pull command, because it defaults to the originating repository.

If you have an interesting patch for the linux kernel, then you might make your repository publicly available by hosting it with gitosis or other software. Then you would just have to convince Torvalds to git pull from you ;-)

Typically developers will also distinguish between their "private" and "public" repositories. You can use "git push" to push changes from your private to your public repository.

Wim Coenen
my code is already on github. So you suggest that the other person should pull all the code...create their own repository and i should get their changes and merge mine?
patrick
+2  A: 

When it comes to collaborating on GitHub, there are two policies:

1/ Forking

This is the recommended path.
Basically, your colleague:

  • clone your repo (called upstream) into his repo (on GitHub, called origin),
  • clone his GitHub repo (origin) on his desktop (local),
  • and do whatever he want between his local repo and his GitHub repo origin.

He will only push to origin because he is not allowed to push on upstream (the ssh-based authentication would fail on your upstream repo)

Whenever he wants you to integrate in your GitHub repo some changes, he will make "pull request" (through his GitHub repo admin UI), notifying you of some commits to apply.
See this script by Andre for automating the process.

2/ Granting commit access

That is a less safe route, where you add his public ssh-key to the list of users/keys allowed to push directly to your upstream repo.
See "Managing Collaborators".

VonC