L
L
leha782015-10-12 13:02:24
git
leha78, 2015-10-12 13:02:24

How to make it easier to work with Bitbucket (my use case inside)?

When developing a website, I work locally and upload the code to bitbucket. From there, I clone the site to hosting and launch. When I need to continue working with this site and I need to keep the site up to date on the hosting, I send the code to bitbucket as usual, then I go to the hosting via SHH and pull the changes from bitbucket from there. I'm tired of doing this every time. How can I more or less automate this process so that I don't have to do two gestures? I need the hosting to have up-to-date code, but I didn’t do two steps.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
A
Andrey Sokolov, 2015-10-12
@leha78

What for? let's imagine the situation that you screwed up and pushed the deletion code for all users, well, I don't know just like that, and then they fixed it on the locale.
In general, this is normal, but you can still dig in the direction of Hooks

A
Artem Spiridonov, 2015-10-12
@customtema

I am using rsync.
Not as an alternative, but as an addition to mercurial. As a means for such quick updates.
For greater convenience, I created the update.sh file, which is stored in the root of the project:

rsync -vzPurp --exclude 'files' ./* пользователь@айпишник:/home/путь/к/нужной/директории

R
RomkaChev, 2015-10-12
@RomkaChev

If $10 per month is not critical - use deploybot.com - the first repository is (sort of) free. You will immediately forget about the hassle with hooks.

K
Konstantin Kitmanov, 2015-10-12
@k12th

dokku . When pushing to a special remote (like git push master production), the code is deployed where it needs to be. Read more 1 , 2 .

D
dmitriy, 2015-10-12
@dmitriylanets

codeship.io perfectly deploys projects from bitbacket to any server via ssh using rsync in seconds (100 deploys per month for free)

C
Cat Scientist, 2015-10-12
@eruditecat

But you have a working development version of the site, right? And you test the performance on it? If so, you won't have to push new code into production very often. Well, for example, only a new feature or a bug fix can serve as a reason for this. A series of these is better. At the same time, all changes are holistic and logically complete. Well, how often? Once a day? IMHO, the time spent on the optimization you are asking for will not pay off. And if you really want to, then you can write the simplest solution yourself and put it in ~/bin/.

A
Alexey Shumkin, 2015-10-22
@ashumkin

in addition to hooks (I don't know what hooks bitbucket provides, and there is no local post-push hook in Git):
it is not necessary to "SSH into the hosting" to pull changes there (I suspect that this happens "handles" , which is annoying, because you need to go in, change the directory, execute git pull ... right?)
This can also be automated, because. ssh is not necessarily an interactive session. allows and execute command (ssh <host> command)
i.e.
visit <remotehost>, do a git pull on the directory, and exit.
And coupled with Git's alias , you can make alias like
then
everything that is specified in alias will be executed during execution (see git alias --help for more details ), that is, the code will be launched on BitBucket, and if it is successful, it will be pulled out immediately on the hosting

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question