Click here to Skip to main content
Click here to Skip to main content

.git and Dropbox Integration within Visual Studio

, 23 Sep 2013
Rate this:
Please Sign up or sign in to vote.
Simple and free approach to manage your code on cloud with git-SCN and dropbox

Introduction

This is a simple implementation of source control on cloud and its integration with Visual Studio. I am using two terms, source control and Cloud which can be managed by the following masters:

Background (Inspiration)

As a developer, I used to have vss/tfs or git to manage version and source, however everything is local as I can't afford a server or cloud to hold my code. After using git and dropbox on side lines, I had a thought to use them as a single entity where we can manage our code using git and push it to permanent/accessible cloud system (dropbox), hold on ... and also we can share our dropbox folder with peers/friends too. So isn't this making it a complete client server/cloud based version control that can be used by multiple users like any other tools available in the market .... but for free.

Hence I Googled it and found about 247,000 results (of course, I was not the first one on earth who thought about that). Anyway, most of the solutions were complicated for a git novice like me. So I found a simpler way to achieve it and integrate with Visual Studio too.

Pre-requisites

  1. Install git extension and Dropbox and of course
  2. VS 2010/12 (or newer)
  3. In addition to this, we would require some interface by which we can link Visual Studio to Git Source Version Control. To achieve this, Go to ‘VS->Tools->Extension and Updates’ and search for "Git Source Control Providers" and download it.

Integration

  1. First we need to make Source Control Selection for VS. Go to "Tools->Option->Source Control"  and select Git Source Control Provider.  
  2. I assume that after installing Dropbox, you must have a folder called “Dropbox” , So navigate to that folder and create a new folder to hold our shared/centralized repository, named it like “Repos” (or as you wish).
  3. Now, we need to add project under git version control. It can be done easily by right clicking solution or project node select “Create new Repository”. It will create a LOCAL repository. Now open “Pending Changes” window and select all files and click on commit.

  4. We would require a centralized repository that can hold our code/source. So there are two ways by which we can create an empty Centralized repository.
    1. Go to Dropbox->Repos folder, right click and select "Git Init Here" and rename newly created .git folder with "demo.git".
    2. Go to VS, open your project (that is already in local git control) and find pending changes Window and click on Git Bash or right click Solution node in Project explorer and Select git->Git Bash. This will open a console window.

    Navigate to target folder by typing the following command in console:

    $cd d:\\ Dropbox \\ Repos 
    $git init --bare demo.git 

    Any of the above two steps will create a new fresh repository.

  5. Now to add that local project to this newly created repository, we need to add one remote.
  6. Open GitBash from project and type the following command:
    git remote add demoremote d:\\dropbox\repos\demo.git 
  7. Now push changes using:
    git push demoremote master 

    The above command will push your previously committed changes to central repository.

  8. Let's assume that your peer does not have this project yet, and then he/she needs to clone your centralized (demo.git) repo to his machine. To do this, first he/she has to comply with all prerequisites and you need to share your “Repos” folder with your peer using Dropbox.com.
  9. After sharing completes, your friend/peer will be able to access “Dropbox/Repos” on his machine.
  10. Open GitBash in peers computer, navigate to target folder where you want the source code copy and use the below command:
    git clone file://g:\\dropbox\\repos\demo.git 

    (assuming that your peer has dropbox in g:\\ drive)

  11. Your peer can create some remote to push/pull changes from/to repository (as described in step 5).
  12. All things are in place. Now when someone pushes up their changes, you can simply get them using the below command:
    git pull someremotename master 

    or by right clicking in solution explorer, any file git->pull.

Conclusion

I really explained it in length as I tried to cover git integration with Visual Studio too, but it is simple and quick. I/we learned a new way to do old things in a very innovative and efficient way. Please leave your comments. If you have any doubts/queries, I will try my best to answer you.
(Disclaimer: I have not mastered git, just started using it.)

Folks, the world is open to tweak, hence this approach too. Please make it more usable/optimized/relevant as per your requirement.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

sumit_kapadia
Software Developer
India India
No Biography provided

Comments and Discussions

 
BugBad idea PinmemberSean Jones30-Oct-13 23:50 
AnswerRe: Bad idea Pinmembersumit_kapadia31-Oct-13 9:35 
GeneralMy vote of 5 PinmemberLoveJenny22-Sep-13 15:37 
Questiongood article PinmemberLoveJenny22-Sep-13 15:36 
AnswerRe: good article Pinmembersumit_kapadia23-Sep-13 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 23 Sep 2013
Article Copyright 2013 by sumit_kapadia
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid