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 open multiple tabs on 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 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.
- 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
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