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

Asked

Viewed 36 times

0

I have a bash script running in Ubuntu 16.04 whose goal is to create a project (Folder) Expandable and then create that same repository in bitbucket and then push the content to the repository that has just been created in bitbucket.

The only part that is missing is the push to the 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

1 answer

1


I think it goes something like this.

https://$USR_BITBUCKET:[email protected]/$USR_BITBUCKET/$VHOST.git 
git push -u origin master
  • exactly... only needs a small change in your code. changes your answer there git remote add origin https://$USR_BITBUCKET:[email protected]/$USR_BITBUCKET/$VHOST.git here the $VHOST=ZIP

Browser other questions tagged

You are not signed in. Login or sign up in order to post.