-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.

dev-jim
  • 1,736
  • 2
  • 28
  • 52
  • 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](https://www.atlassian.com/git/tutorial), or the [free Pro Git book](http://git-scm.com/book). Then ask if you don't understand a specific problem. [This question](http://stackoverflow.com/questions/6590688/is-it-bad-to-have-my-virtualenv-directory-inside-my-git-repository) answers your specific question about virtualenv. – Amadan Sep 02 '14 at 04:41

1 Answers1

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://git@bitbucket.org/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
Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283