Regarding configuration of a central, shared Git repository

56 views Asked by At

We've just started using Git in our workplace and though we're learning a lot using Git on our local systems, there's one thing that we haven't been able to do yet.

I want to create a repository on my system which should be accessible to other systems on my network for clone, pull, push etc. commands.

I read around and found out that here's what I need to do:

1.Create a bare repo on my system (say, System A) using the following command:

git init --bare --shared=all

2.Then, if I want the user on System B to have access to my repo on System A, here's what I need to do:

i.Generate a public-private key pair for the user on System B by running the following command on user B's gitbash:

ssh-keygen

ii.Copy user B's public key and paste it in my (i.e. System A) ~/.ssh folder. Suppose the name of user B's public key is userb.pub

And this is where I'm stuck:

iii.Add user B's public key (userb.pub) to the list of authorized keys on my system.

*But I can't find any file called authorized_keys in my ~/.ssh folder!*

And even if I created my own authorized_keys file, how would I add all of the public keys to it? In the same line? No separators? Would I need to add my own key (i.e. System A's key) to this file?

Would Git recognize any file I created without any command specifying so??

And where does the ~/.ssh/config file come into all of this?

We've got msysgit installed on all of our systems. Installing any other software isn't really possible right now because we need to take special permissions for that in our environment.

1

There are 1 answers

2
Michael On

You should create a file called authorized_keys and add user B's public key to this file (newline separated).

Basically:

cat userb.pub >> ~/.ssh/authorized_keys

userb.pub (if it was created correctly) should already be properly formatted.