The easiest way to permanently redirect (301), when dealing with apache2 that is, would be these three lines of code below:

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

The way this works in NGINX is just as easy:

server_name git.server.com; 
## Don't show the nginx version number, a security best practice 
server_tokens off; 
location / {
	return 301 https://git.server.com:443$request_uri;
}