Firstly we have to check whether git is installed on our system. I
am using CentOS 6.x.
[root@git ~]# rpm -qa | grep git
It will display all the packages of git. If nothing appears then
install the git.
[root@git ~]# yum install git -y
Git Configuration
Now we can start with the configuration part:
Create a git user and .ssh directory for that user as well as set
its permissions. Then we can create a project under user selected path.
[root@git ~]# sudo adduser git
[root@git ~]# su git
[git@git ~]# cd
[git@git ~]# mkdir .ssh && chmod 700 .ssh
[git@git ~]# touch
.ssh/authorized_keys && chmod 600 .ssh/authorized_keys
[root@git ~]# mkdir /opt/gitrepos (With root user)
[root@git ~]# mkdir /opt/gitrepos
[root@git ~]# cd /opt/gitrepos (With root user)
[root@git ~]# mkdir repos.git
[root@git ~]# mkdir repos.git
[root@git ~]# chown git:git repos.git -R
[git@git ~]# cd repos.git (With Git user)
[git@git ~]# git init --bare (With
--bare option we cannot commit anything in this dir )
Initialized empty Git repository in
/opt/gitrepos/reposrepo.git/ (Message
would appear)
Secure the git shell
When we add the users in the git server to access the repos it
will also give them access to access the git server. To secure the server we
have to apply some changes on git shell level.
[root@git ~]# which git-shell (check which shell is using git)
[root@git ~]# chsh git (add the shell path e.g
/usr/bin/git-shell)
Now if we do ssh (ssh git@IP_address),
it will restrict the user to enter the shell by below statement.
" fatal:
What do you think I am? A shell? "Git Client Configuration- http://greenwhitehat.blogspot.com/2017/06/git-client-installation-and.html
Comments
Post a Comment
Please give your review or ask question ?