How to do a git push to bitbucket programmatically using BASH in Ubuntu16.04?

0

I have a bash script running on ubuntu 16.04 whose goal is to create a laravel project and then create that same repository on bitbucket and then push content to the repository just created on bitbucket.

The only part that is missing is the push to bitbucket. Here is the code:

//Criar o repositório no bitbucket  
curl --user $USR_BITBUCKET:$PSSWRD_BITBUCKET https://api.bitbucket.org/1.0/repositories/ --data name=$NEW_REPO_BITBUCKET

//Vá para o diretório de Laravel que foi criado programaticamente
cd cd $HOME_PATH/vhosts/$VHOST
//Inicialize como git
git init
//Mudar os privilegios do folder do projeto
sudo chown -R $UBT_USER:www-data $HOME_PATH/vhosts/$VHOST/
//Config inicial do git    
git config --global user.email "${GIT_EMAIL}"
git config --global user.name "${USR_BITBUCKET}"
//Add and commit
git add .
git commit -m "First commit - bash"
git status    

// ----   Ate este ponto esta tudo certo

//Fazer o push para o bitbucket - Aqui é a duvida
    
asked by anonymous 23.03.2018 / 15:37

1 answer

1

I think it's more or less like this.

https://$USR_BITBUCKET:[email protected]/$USR_BITBUCKET/$VHOST.git 
git push -u origin master
    
23.03.2018 / 15:43