Let's say you have been working day in, day out on a new spike/code/project locally on your laptop with a local git repo. And now ready to publish this to the Bitbucket server. This would require following steps:
1. Create a project on Bitbucket server.
2. Create the repository under the new project.
3. Assign users/group with write permissions to the project and repository.
4. Finally import your code into the remote repository by adding remote "origin" and pushing the code.
5. As an add-on, if you have Jenkins CI server, and want to run the one time external async post receive hook. (https://marketplace.atlassian.com/plugins/com.ngs.stash.externalhooks.external-hooks/server/overview). The hook is disabled after pushing the code.
(Note: The external post receive hook will be enabled with the settings as shown below. The jenkins user/password is taken from the credentials selected in plugin configuration).
This plugin does all of the above for you.
Creates a Bitbucket repository (and associated project) from the current code.
Jenkins version 1.625.3 or newer is required.