Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

can I creat remote repository useing local commindline?

Tong Leslie
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 18, 2018

Because create repositories one after another on bitbucket website  spend so much time.

Can I use local commandline to create remote repositories ?

 

3 answers

1 vote
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2018

You can make API calls to Bitbucket to create repositories; using a tool like curl, you can do that from the command line. For both Bitbucket Cloud and Bitbucket Server, it's a POST, but the parameters are a bit different for each:

Bitbucket Cloud: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D#post

Bitbucket Server: https://docs.atlassian.com/bitbucket-server/rest/5.12.0/bitbucket-rest.html?utm_source=%2Fstatic%2Frest%2Fbitbucket-server%2Flatest%2Fbitbucket-rest.html&utm_medium=301#idm45885144780848

If you'd rather use Terraform (for BB Cloud only), then https://www.terraform.io/docs/providers/bitbucket/index.html may be helpful.

0 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2018

You cannot create a remote repository from your local machine via git commandline.
You need to be logged in on the remote machine to create a local repository on the remote machine. As soon this repository exists on the remote machine, you con connect your local repository to the remote repository via "git remode add ..."

As the remote machine can be any machine on the net, it does not make much sense to have the possibility to create a remote repository from your local machine (mostly due to access limitations you have on the remote machine) via git commandline. The remote repository is mostly maintained by anybody else than yourself. Git is a decentralized source control system - mainly focused on maintaining a LOCAL repository. There are only a few commands to interact with a REMOTE repository (remote add, push, pull, fetch, clone).

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 19, 2018

 

Hi Tong, welcome to the Community!

Yes, you can create repositories using only the command line, but I'm not sure it will save you a lot of time compared to creating them from Bitbucket. As you didn't specify, I'll assume you're using Git as this is the most extended, in that case you can create the repositories following the instructions at Setting up a repository.

Let us know if that helped you :)

Kind regards,

Ana

Tong Leslie
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 22, 2018

Hi Ana, 

Thanks for your reply! But I meet some problem, and my step as below :

1. I create a folder in local host, and use "git init" to init the folder.

2. Add a txt.file in the folder, and use the "git commit" to commit the txt.file

3. Using "git push -u origin master", but I got an error =>[Please make sure you have the correct access rights and the repository exists. ]

So I still need to create a repositories on the website first?  

If I have the wrong steps or misunderstand, please tell me!

Thank you very much :)

Kind regards,

Leslie

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events