Gamow shell model (GSM) is usually performed within the Woods-Saxon (WS) basis in which the WS parameters need to be determined by fitting experimental single-particle energies including their resonance widths. In the multi-shell case, such a fit is difficult due to the lack of experimental data of cross-shell single-particle energies and widths. In this paper, we develop an {it ab-initio} GSM by introducing the Gamow Hartree-Fock (GHF) basis that is obtained using the same interaction as the one used in the construction of the shell-model Hamiltonian. GSM makes use of the complex-momentum Berggren representation, then including resonance and continuum components. Hence, GSM gives a good description of weakly bound and unbound nuclei. Starting from chiral effective field theory and employing many-body perturbation theory (MBPT) (called nondegenerate $hat Q$-box folded-diagram renormalization) in the GHF basis, a multi-shell Hamiltonian ({it sd-pf} shells in this work) can be constructed. The single-particle energies and their resonance widths can also been obtained using MBPT. We investigated $^{23-28}$O and $^{23-31}$F isotopes, for which multi-shell calculations are necessary. Calculations show that continuum effects and the inclusion of the {it pf} shell are important elements to understand the structure of nuclei close to and beyond driplines.