Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to push code to the existing bitbucket repository first time using sourcetree ?

Deleted user Feb 25, 2020

Hi,

i have an exitsing code on my local drive and i have created a empty (new ) repo in the bit bucket. now i want to push the code to the repo using the source tree.  i dont want to clone to a new folder and copy the files allover instead i want to commit the existing folder to the repo using source tree not the command line way. Please let me know if anyone has a solution to this.

1 answer

2 votes
Mikael Sandberg Community Leader Feb 25, 2020

Hi @[deleted],

Welcome to Atlassian Community.

There should be instructions for how to populate your repository with local code shown if you access your repository in Bitbucket, but here are the steps:

  1. Cd into your directory that have your code
  2. Initiate it as a Git repository by running these commands
    git init
    git add --all
    git commit -m "Initial Commit"
  3. Copy the URL for you empty repository in Bitbucket
  4. Set the remote URL for your repository and push your initial commit
    git remote add origin <the URL for your Bitbucket repository> 
    git push -u origin master

Done, you should now see your code in Bitbucket.

Like Nicholas Liong likes this

> There should be instructions for how to populate your repository with local code shown if you access your repository in Bitbucket

 

There apparently isn't when keeping the default option (include a .gitignore). And then, then the instructions fail (fatal: refusing to merge unrelated histories).

 

In my case, I had to delete the new repository and create another one, making sure there was no .gitignore. Then the instructions appeared and worked.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,850 views 4 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you