Git and DropBox - An Approach for Small Projects and Small, Distributed Teams
I work on any number of software development projects and over the years have worked my way through any number of source control systems: RCS, CVS, SVN, until now (finally) I've landed on GIT.
Although GIT can be used with only a local repository, I always set it up on a remote repository, basically for two reasons: to have a backup in the event something happens to my computer, and to share the code with other developers, or even with another computer of my own. For some projects, we've created a GIT repository on one of our servers. For others, we've used GitHub, which is fantastic, IMO.
Creating a project repository in GitHub is perfect for projects that are being developed for public access and use, but to create a private GitHub project requires a paid-for account. And while the cost is not huge (~$8/mo at this writing), it would be nice to have an alternative, cost-free option. Enter DropBox.
I use DropBox all the time for transferring files between people and even between multiple computers of my own. It's just too easy. And on most projects in which I'm involved, the whole team uses DropBox to share files. So wouldn't it be cool if I could simply create a GIT remote repository in DropBox and share that with the development team? Yeah. So what we'll do here is set up a "bare" GIT remote repository under DropBox and then use that to capture a project's code. Importantly, this is a bare repo - it's not meant for any developer to commit to directly. Instead, developers should clone from this repo, commit locally, and push back to it.
So here's what I did:
- Download and install GIT (http://git-scm.com/downloads).
While this includes some GUIs, I use the command from a terminal. So after installing, open a terminal or a command window and... - Create a directory in DropBox for the repository. I used git_repos. Then cd into that.
- Initialize a git repository:
git init --bare myproject.git
You should see a message something like this:
Initialized empty Git repository in .../Dropbox/git_repos/myproject.git
And you should see a DropBox notification of this as well.
The URL is important. It needs to point at that new DropBox repository, something like this:cd
git init git add . git commit -m "initial GIT commit" git remote add origin git push -u origin master
d:/DropBox/.../git_repos/myproject.gitThis value will get written into the .git/config file in the project directory and will be used as the location for the "origin" or remote GIT repository.
Other developers on my team can now clone from this:
git clone d:/DropBox/.../git_repos/myproject.git myprojectand so on.
0 comments:
Post a Comment