Adding new repo(gitosis.conf)
Administrator is the only authenticated user for this (In according to previous posts in my case it's janaka). First administrator can log to the server which runs git.First it is better to add the repository on the conf file. And you can add users for this repository.
janaka@versioncontrol~/gitosis-admin $ vi gitosis.conf
Your conf file look like this,
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = janaka@versioncontrol
Edit it and add new repo, Now it will looks like,
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = janaka@versioncontrol
[repo my_first_repo]
gitweb = no
description = This could be my first repo
owner = No one else thats me,
daemon = no
Creating a user group
Your conf file look like this,
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = janaka@versioncontrol
[repo my_first_repo]
gitweb = no
description = This could be my first repo
owner = No one else thats me,
daemon = no
Edit this file and add new group,
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = janaka@versioncontrol
[group my_users]
writable = my_first_repo
members = janaka@versioncontrol gituser1
[repo my_first_repo]
gitweb = no
description = This could be my first repo
owner = No one else thats me,
daemon = no
gituser1 is the newly added user, his key is named as gituser1.pub on keydir/ directory.
Now you should add this changed gitosis.conf file and update gitosis-admin repository. You can do it by executing following commands.
janaka@versioncontrol~/gitosis-admin$ git add gitosis.conf
janaka@versioncontrol~/gitosis-admin$ git commit -m "Added new repo on conf file"
janaka@versioncontrol~/gitosis-admin$ git push
Then you can create the directory you want and create physical repository.
Creating new repository
Create a directory with naming it on your wish.
janaka@versioncontrol~$ mkdir my_first_repoNow go into it,
janaka@versioncontrol/my_first_repo~$ touch readmethen follow the given commands to initialize the repository,
cd my_first_repo192.168.4.90-is the server which runs git on it. Now the new repository is created.
git init
git remote add origin git@192.168.4.90:my_first_repo.git
git add .
git commit -m "Hai buddies, we added my_first_repo"
git push origin master:refs/heads/master
This is it, now gituser1 can use the my_first_repo repository. You can check on client machine,
git clone git@192.168.4.90:my_first_repo
On windows client side, If you'r only using command prompt, why don't you go for TortoiseGit to make life easier. TortoiseGit is a graphical tool to access git repository. Follow
git --bare init
ReplyDeleteis to initialize the repo object. You need not neccessaraly have files in the folder to make the folder a repository