Because create repositories one after another on bitbucket website spend so much time.
Can I use local commandline to create remote repositories ?
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
If you'd rather use Terraform (for BB Cloud only), then https://www.terraform.io/docs/providers/bitbucket/index.html may be helpful.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.