简体   繁体   中英

setting up git server on centos 7 in google compute engine

I have a google compute engine instance on which I want to setup a git server which will be accessed by developers to push and pull development source code. I have created a user called git for accessing the repository. Then added every developers public key to the server /home/git/.ssh/authorized_keys file.

Below are the configurations I issued to do the above mentioned

$ useradd –m /home/git –s /usr/bin/git-shell git

Install git on the server

$ yum install git -y

Configuring ssh authorization for the users

$ cd /home/git
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

Append developers ssh keys to the authorized_keys file on the server

Create a bare repository for the code

$ mkdir /opt/git/project.git
$ cd /opt/git/project.git
$ git init - -bare - -shared=group

Edit the existing permissions

$ chgrp -R developers .

Testing the configurations

$ git clone ssh://git@IP_ADDRESS/opt/git/project.git

when i try to clone the repository, it issues an error:

git clone屏幕截图

Note: I tried the above setup on a physical server and it worked perfectly and didn't need to configure ssh keys on the system. So I am wondering whether it compute engine the problem.

At some point I thought it was an issue of permission on the /opt directory, I thus modified the permissions to read/write for others, but it didn't work. Also I further created a repository but in the home dir of the user git, still it didn't work.

I need some help to solve this issue of authentication of user git.

Solution

i found the trick behind. Actually the machine i was using to clone the project was running windows 8 OS. So the trick was to copy the id_rsa.* (pub and ppk) files in C:\\Users\\USERNAME\\.ssh to the git directory at C:\\Users\\USERNAME\\git\\.ssh .

With this everything works perfectly.

i found the trick behind. Actually the machine i was using to clone the project was running windows 8 OS. So the trick was to copy the id_rsa.* (pub and ppk) files in C:\\Users\\USERNAME\\.ssh to the git directory at C:\\Users\\USERNAME\\git\\.ssh .

With this everything works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM