Today I started my new project, and I want to keep my code in the BitBucket, and very often I forgot how to !#@!$!$#
rather I keep googling it’s better I documented in my own blog.
Import code using the terminal
Import code from an existing project using the terminal by first cloning the repository to your local system and then pushing to an empty Bitbucket Server repository.
Import an existing, unversioned code project into Bitbucket Server
If you have code on your local machine that is not under source control, you can put it under source control and import it into Bitbucket Server.
Assuming you have Git installed on your local machine, then:
- Locally, change to the root directory of your existing source.
- Initialize the project by running the following commands in the terminal:
git init git add --all git commit -m "Initial Commit"
- Log into Bitbucket Server and create a new repository.
- Locate the clone URL in the nav panel on the left (for example: https://firstname.lastname@example.org:7999 /yourproject/repo.git).
- Push your files to the repository by running the following commands in the terminal (change the URL accordingly):
git remote add origin https://email@example.com:7999/yourproject/repo.git git push -u origin master
- Done! Your repository is now available in Bitbucket Server.