From: James L. <jh...@jl...> - 2009-05-14 03:45:18
|
Hi Hasnain, Please see answers to your questions inline. On May 11, 2009, at 8:19 AM, Hasnain Javed wrote: > Hi, > > My apologies if this is the wrong section to post this question > (please > redirect to the correct section to post the question) This is the right place to post this question. :-) > How can I connect to a remote git repository ?? is it mandatory to > have .git folder on my local machine ? what we are trying to do is to > write a custom ANT task that would connect to the git repository and > checkout the latest files from it. Git is a bit different from CVS or SVN. Git works by keeping a complete copy of the repository locally, thus the .git directory is always there. Two ways to do what you ask with git is: 1) - Check if a copy of the git repository is stored locally. If not, clone of the git repository to the desired local location (git clone) - Run the following two commands to get all new commits to the remote repository: git fetch git pull 2) This method is a little brute force but is the easiest way to do it with JavaGit: - Delete the local copy of the repository and then clone the remote repository again JavaGit does not have the wrappers implemented for 'git fetch' and 'git pull', so method 2) is a way to do this using JavaGit. The edu.nyu.cs.javagit.api.commands.GitClone class is what to use for 'git clone'. If you want to follow method 1) above, a GitFetch and/or GitPull implementation would need to be written for 'git fetch' and 'git pull'. If you want to do this and have questions, please ask; we would be happy to give pointers. Also, if you do end up making such an implementation, send a patch to the jav...@li... mailing list for consideration for inclusion with the library. Regards, James |