Asked  6 Months ago    Answers:  5   Viewed   28 times

Is it possible to use Git and Dropbox together?



I think that Git on Dropbox is great. I use it all the time. I have multiple computers (two at home and one at work) on which I use Dropbox as a central bare repository. Since I don’t want to host it on a public service, and I don’t have access to a server that I can always SSH to, Dropbox takes care of this by syncing in the background (very doing so quickly).

Setup is something like this:

~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/git

~/Dropbox/git $ git init --bare project.git
~/Dropbox/git $ cd ~/project

~/project $ git remote add origin ~/Dropbox/git/project.git
~/project $ git push -u origin master

From there, you can just clone that ~/Dropbox/git/project.git directory (regardless of whether it belongs to your Dropbox account or is shared across multiple accounts) and do all the normal Git operations—they will be synchronized to all your other machines automatically.

I wrote a blog post “On Version Control” in which I cover the reasoning behind my environment setup. It’s based on my Ruby on Rails development experience, but it can be applied to anything, really.

Tuesday, June 1, 2021
answered 6 Months ago

You will create an interface as a new class in your project:

public interface ApiService {
    YourObject getUser();

Then in your activity you will call the following:

RestAdapter restAdapter = new RestAdapter.Builder()
                    .setConverter(new SimpleXmlConverter())

ApiService apiService = restAdapter.create(ApiService.class);
YourObject object = apiService.getXML();

To get your libraries correctly, in your build.gradle file you need to do the following:

configurations {
    compile.exclude group: 'stax'
    compile.exclude group: 'xpp3'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.squareup.retrofit:retrofit:1.6.1'
    compile 'com.mobprofs:retrofit-simplexmlconverter:1.1'
    compile 'org.simpleframework:simple-xml:2.7.1'
    compile ''

Then you need to specify YourObject and add annotations to it according to the structure of the xml file

@Root(name = "breakfast_menu")
public class BreakFastMenu {
    @ElementList(inline = true)
    List<Food> foodList;

public class Food {
    @Element(name = "name")
    String name;

    @Element(name = "price")
    String price;

    @Element(name = "description")
    String description;

    @Element(name = "calories")
    String calories;
Tuesday, June 29, 2021
answered 5 Months ago

Yes, it is important to keep your Git folder outside of Dropbox.

Dropbox can sometimes get confused and create a lot of duplicates of your files, such as filename~(conflict), which can really mess up your Git repository and require time to clean up.

Tuesday, August 10, 2021
answered 4 Months ago

So based on what you said, these files are libraries/documentation you don't want to delete but also don't want to push to github. Let say you have your project in folder your_project and a doc directory: your_project/doc.

  1. Remove it from the project directory (without actually deleting it): git rm --cached doc/*
  2. If you don't already have a .gitignore, you can make one right inside of your project folder: project/.gitignore.
  3. Put doc/* in the .gitignore
  4. Stage the file to commit: git add project/.gitignore
  5. Commit: git commit -m "message".
  6. Push your change to github.
Friday, September 3, 2021
answered 3 Months ago

I've done exactly that and it works fine. I've also done this on a thumb drive and an external USB drive without any problems.

Sunday, October 3, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :