I want to deploy git(not github) through docker.
What do you mean? You want to run a git server in Docker to host your code? Look at gitea, GitLab, …
Make sure to bind mount the data folder from host or use a Docker volume, so your source code is not deleted when updating the container.