-1

I have an existing django project on my local machine (in virtualwrapper). How do I add it to the Bitbucket?

Let say my django project is like this:

project
  --manage.py
  --apps
  --db.sqlite3
  ...

So should I do 'git init' under 'project' directory? Since it is develop in the virtualwrapper, so I think only the project files will be pushed to the Bitbucket, is that right? If I want to develop the project on a different computer, and want to pull the project files from Bitbucket, how should I do it? I mean should I create another virtual environment in my new machine, install django and necessary pakcages before import the files from bitbucket?

I am new to git, so I don't know what is the best to do it.

1
  • 1
    Sorry, too broad. We can't and won't teach you Git here. You would be better off reading a Git tutorial like the one the fine folk at Atlassian put up, or the free Pro Git book. Then ask if you don't understand a specific problem. This question answers your specific question about virtualenv. Commented Sep 2, 2014 at 4:41

1 Answer 1

1

So should I do 'git init' under 'project' directory?

Yes, but after that, don't add everything.
Create a .gitignore file first, where you declare the files that shouldn't be versioned (the one that are generated)

Then add and commit: that updates a local repo.
you can easily link it to an existing empty BitBucket repo:

git remote add origin ssh://[email protected]/username/myproject.git
git push -u origin master # to push changes for the first time

Normally, you wouldn't store a binary like db.sqlite3 in a source repo.
But this blog post suggests a way to do so through

In a .gitattributes or .git/info/attributes file, give Git a filename pattern and the name of a diff driver, which we'll define next. In my case, I added:

db.sqlite3 diff=sqlite3

Then in .git/config or $HOME/.gitconfig, define the diff driver. Mine looks like:

[diff "sqlite3"]
    textconv = dumpsqlite3

I chose to define an external dumpsqlite3 script, since this can be useful elsewhere.
It just dumps SQL to stdout for the filename given by its first argument:

#!/bin/sh
sqlite3 $1 .dump
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Oh yes, you were right. I just exclude the db file to be committed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.