Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new BitBucket repository for existing files from Ubuntu

I have files that I want to add to a new repository on BitBucket. How can I do this using a command line from Ubuntu ?

An alternative would be to create the repository first from the BitBucket website but I don't know how to clone a repository into a non-empty directory.

like image 944
matdev Avatar asked Nov 18 '13 10:11

matdev


2 Answers

More detail on Bruce's comment:

When you create a repo at BitBucket, you are offered two links:

  • "I'm starting from scratch"
  • "I have an existing project to push up"

Click on the 2nd, and you will be given the commands to run in your local repo. These would look like:

> cd /path/to/my/repo
> git remote add origin https://[email protected]/me/test.git
> git push -u origin --all # pushes up the repo and its refs for the first time
> git push -u origin --tags # pushes up any tags
like image 98
Number8 Avatar answered Nov 10 '22 04:11

Number8


You do not need to do a clone anyway. And also the accepted answer is not correct. You need to do a git add . and then git commit before pushing.

This is the complete set of steps to follow, to do what you want: Create a git BitBucket/ Github repository from already locally existing project - samranga.blogspot.com

like image 24
Samitha Chathuranga Avatar answered Nov 10 '22 03:11

Samitha Chathuranga