Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create new repo on Bitbucket from Git Bash terminal?

Tags:

git

bitbucket

Is it possible to create a new repository in Bitbucket by using command line Git? I have tried the following:

git clone --bare https://[email protected]/username/new_project.git 

I get this message:

Cloning into bare repository 'new_project.git'...
fatal: https://[email protected]/username/new_project.git/info/refs not found: did you run git update-server-info on the server?

It would be nice to do this without going to the web app.

like image 534
Patrick Avatar asked Dec 09 '12 14:12

Patrick


People also ask

How do I add files to Bitbucket using git bash?

To add and commit files to a Git repository Create your new files or edit existing files in your local project directory. Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.


2 Answers

You can use the Bitbucket REST API and cURL. For example:

curl --user login:pass https://api.bitbucket.org/1.0/repositories/ \ --data name=REPO_NAME 

to create new repository named REPO_NAME.

See Use the Bitbucket REST APIs for more information.

UPDATE

For Bitbucket V2 specifically, see POST a new repo

like image 129
Marek Avatar answered Sep 20 '22 18:09

Marek


https://confluence.atlassian.com/bitbucket/repository-resource-423626331.html

$ curl -X POST -v -u username:password -H "Content-Type: application/json" \   https://api.bitbucket.org/2.0/repositories/teamsinspace/new-repository4 \   -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }' 
like image 23
mcfw Avatar answered Sep 21 '22 18:09

mcfw