This is the method that worked for me, I am not sure if this is the correct one.
All I did was to clone my blog from my git repository in another directory, then, using rbenv I have installed the 2.6.3 version of ruby and swithed to it.
Then renamed the Gemfile.lock in order not to lose changes.
mv Gemfile.lock Gemfile.lock.bak
Then I have installed bundler
gem install bundler
After that I have edited the Gemfile from this
gem "middleman", "~>3.3.12" gem "middleman-blog", "~> 3.5.3"
gem "middleman", "~>4.3.6" gem "middleman-blog", "~> 4.0.0"
Finally I run
That was it.