Creating a Repository from an Online Source

Mark Yorkovich June 27, 2013

I have a project on my own hosted domain (say, http://project.mydomain.com).

I created a repository in my BitBucket account, but I'm not sure what I need to do from there. How do I set up my online source code to push to the BitBucket repository?

I did go through most of the BitBucket101 tutorial, but either I went over it and it went over my head, or this specific situation isn't covered.

If instructions reference a specific interface, if possible, I'd appreciate it if I could do it in Tortoise Workbench - also, if instructions do exist, please let me know!

Your help will be greatly appreciated!

1 answer

0 votes
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2013

You can do this from the command line by doing the following:

In your project's source code directory, run

git init

This will create a new git repository in that directory. Then, you need to tell the new empty repository about your files.

git add -A

Of course, this will add every single file in the directory, which you probably don't want to do. To exclude files, like ones from your IDE or editor, create a gitignore file. Now that all your files are being tracked by Git, tell git to commit them.

git commit -m "Initial project setup in Git."

That will tell git to save a snapshot of all the files you told it to track. -m is to set the commit message. Now, it is time to push your changes from your local repository up to Bitbucket. First, add the URL to your repository to the 'origin' alias.

git remote add origin https://bitbucket.org/username/repo.git

And finally, push your code up to Bitbucket.

git push -u origin master

That will push your initial commit to Bitbucket. From there, when you make changes in your local directory, you always commit then push them up to Bitbucket. We don't have specific instructions for Tortoise, but I found this blog post that will probably help.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events