Skip to content

Instantly share code, notes, and snippets.

@slavama
Created April 3, 2017 03:40
Show Gist options
  • Save slavama/fae3990a26221e8b2fc03c21a9fa2cf8 to your computer and use it in GitHub Desktop.
Save slavama/fae3990a26221e8b2fc03c21a9fa2cf8 to your computer and use it in GitHub Desktop.
Create remote private repository
#!/bin/bash
PROJECT=$1
REPO_USER=myusername
REPO_API_URL=https://api.bitbucket.org/1.0/repositories/
PROJECTS_DIR=/home/username/projects
APP_DIR="$PROJECTS_DIR/$PROJECT"
curl --user $REPO_USER $REPO_API_URL --data name=$PROJECT --data is_private='true' --data scm='git'
if [ ! -d $APP_DIR ]; then
mkdir $APP_DIR
fi
cd $APP_DIR
git init
git remote add origin "http://bitbucket.org/$REPO_USER/$PROJECT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment