In this post, we want to discuss how to import project in Bitbucket using the terminal or bash. Before we get started, if you want to know about opening multiple tabs with one click, please go through the following article: Open multiple tabs on button click in C#.
Import code from an existing project using the terminal by first cloning the repository to your local system and then pushing it to an empty Bitbucket Server repository. 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.
Import code for a new project to 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:
12345git initgit add --allgit 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:
git remote add origin https://[email protected]/techaid24/myfirstproject.git(Here: techaid24 is my bitbucket user name and myfirstproject is my repository name.)
- Push your files to the repository by running the following commands in the terminal (change the URL accordingly):
1234git remote add origin https://[email protected]/techaid24/myfirstproject.gitgit push -u origin master
- Done! Your repository is now available in Bitbucket Server.
Adding code to an existing project to Bitbucket Server
After first cloning the repository, you need to update the project at any time. Use the bellow code to push your updated code
$ git add --all
$ git commit -m "contra"
$ git push origin master
If you face any problem to push your updated code, then you should push with force.
$ git push origin master -f
import project in bitbucket using the terminal or bash
The article was published on October 1, 2018 @ 12:07 AM
Leave a Comment