Is there a way to use Raspberry Pi 4 B as a git server with gitlab installation and make is accessible from anywhere? from a home connection and in a secure way?
I think it is possible. Probably as secure as it can be because it’s a public facing service. You could make it more secure by only allow a few ips to access it for example the ip block from your workplace.
Yes, it’s possible, although depending on what You want to do with it, the hardware may not meet the requirements. If it’s for You and/or a small team, no problem.
Regarding security, that will depend on the server admin. You will have to do a search on how to harden Your server .
I’m not sure about a git server however with the new pi 4 being a lot more powerful than the 3 b+ I’ve been investigating running one as a web server to host my portfolio, a WordPress blog, and file server which according to the official pi forum responses that I’ve had, this is definitely within its capabilities.
My advice would be to post your question on that forum too