Importing local source code into repository (BitBucket or GitHub)

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:

  1. Locally, change to the root directory of your existing source.
  2. Initialize the project by running the following commands in the terminal:git init git add --all git commit -m "Initial Commit"
  3. Log into Bitbucket Server and create a new repository.
  4. Locate the clone URL in the nav panel on the left (for example: https://username@your.bitbucket.domain:7999 /yourproject/repo.git).
  5. Push your files to the repository by running the following commands in the terminal (change the URL accordingly):git remote add origin https://username@your.bitbucket.domain:7999/yourproject/repo.git git push -u origin master
  6. Done! Your repository is now available in Bitbucket Server.

original source:

Leave a Comment

Your email address will not be published. Required fields are marked *