Creating a Repository from an Online Source

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

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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

696 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot