Adding "owner" field in gitolite gitweb? - gitolite

I am trying to add an owner name of repo that shows up on gitweb.
I can't seem to find anything on the net.
Anybody knows how to do it?
I know to change the description of repo by ssh git#server desc reponame "string"
But, there seems nothing for owner.
Thanks

First, gitolite and gitweb are two different tools:
gitolite is an authorization layer in perl (which can be integrated to gitweb).
it needs to be installed in addition of Git, and be called from one of the listeners (httpd or sshd) which does the authentication.
gitweb is a web interface, part of the Git distribution.
A repo as stored on a Git hosting server is not "owned" by a user.
It only has in gitolite a list of users who are authorized to push to it.
The gitweb.perl perl script does try to get the ownership information, based on, for instance, a git config owner property attached to the repo. Or from the folder owner.
None of those information are native to a Git repo hosting server, and you need to make sure the right owner is registered somehow (with, for example, adding that config to the repo, which can be set with Gitolite)
In any case, you would need to make sure $omit_owner is not set to 1.

Related

Some users in git prevent other users to push commits to the remote using git with SSH

We are using git for source code management and own a SLES server which we use as a remote for our git repositories. We access git with SSH, using the real user names, not the single git user alternative, which would authenticate through the authorized_keys file of the git user.
A while ago, I figured out a problem with pushing to our remote. One user was able to push while another user was not able to push. So I began to analyze, why certain users are not able to push. I finally figured out what the root cause was: A bare repository on the remote always has a directory named objects, where commits are finally saved through the push process. This directory contains sub directory with the first two characters of a hash value. If a directory has not been created yet, it is created during a push to the remote.
And here's the mysterious thing about it, I cannot explain to myself: Some users create these directories with permissions rwxrwsr-x, while other users create them with rwxr-swr-x. As you can see, the set-gid bit is set, which is OK. But I cannot really explain why some users create directories with group write permissions while others do not.
The pitfall here is that if user A creates a directory without group write permissions and user B calculates a hash value that begins with the two characters of the already created directory of user A, user B cannot place files (commits) in that same directory, which makes it impossible to push to the remote for user B.
I have already watched out for default umask settings, that are probably different, but could not find different settings. All users on our SLES server have the default mask 0022, which will result in files being created with rw-r--r-- and directories with rwxr-xr-x. And this is the second mystery: Why do some users create directories in git with rwxrwsr-x (which is correct for git and intended), despite of the umask 0022?
Has anyone hints for me for further troubleshooting? What I want to achieve is that users create the objects sub directories with rwxrwsr-x.
Set
git config core.sharedRepository 0660
at the server repo. See the docs.

Use git server without git user

I have a remote linux machine with only one user.
I just set up git repos on it without a git user. But all the tutorials suggest me to use the git user. So right now I am using
git clone user#hostname:/path/to/git/directory/your_project.git
rather than :
git clone git#hostname:/path/to/git/directory/your_project.git
And it works fine.
If I use the git account, for each project I have to change permission for that project and change the config to share the directory.
Does using the setting up and using a git user have any advantage over using your user account on linux?
Not much, maybe convention - git automation tools and APIs might expect a git user, but I've never come across such a situation.
Sources: https://git-scm.com/book/en/v1/Git-on-the-Server-The-Protocols and https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps
The second one describes the creation of a git user, and then you get the URLs (over SSH, using a SCP-like syntax, as referenced in the first article's second method) to be git#server:.
You've essentially done the same thing but with whatever user instead of a user named git, so you get user#server:

Including my own scripts in the admin-repo with gitolite

I have some scripts that I call from a common hook of gitolite, I want to manage them from the configuration directories of the admin-repo repository so I can modify them more easily and they will be versioned also.
I have tried by adding a new directory and by tracking it with git add, but it does not work as expected. Maybe gitolite has some way to do this but I have not found any information on how to do such a thing.
Note: the following is for Gitolite V3 or g3 only.
You can add/manage them in their own directories, namely the "hooks/common" sub-directory if the gitolite-admin (create it if it doesn't exists).
That directory will appear in your Gitolite server in ~/.gitolite/hooks/common, and if you define a LOCAL_CODE rc variable) pointing to it, it will be taken into account.
You might need to follow the push of the gitolite-admin repo by a gitolite setup --hooks-only on the server though.

Setting Commit and Checkout Privileges for a Git Repository

We are having a local repository which is accessible to a large number of people. We have to set up a Git repository there such that only certain users have checkout as well as commit privileges. How can we do that.
P.S. : This is a part of our homework assignment in which we have to develop a game and update it using a Git repository. So, if anyone feels like we should not be asking this question here, please do tell.
I'd recommend gitolite to manage user access to the repository.
Edit after comments:
gitolite is installed via git too.
I'm guessing that your teacher probably also meant to teach you – besides using git – to configure git protocols, ssh access (keys etc.).
You already got best advices: gitolite, gitosis, Pro git, adding to this man ssh, man ssh-keygen, man scp and git manual your homework should be easily solved.
Since it is homework I will try to give hints.
What files and directories do other users need to read to access (or write to commit/push into) a repository?
What methods can you use to control the permission on these files and directories?
Does your application have any configuration options that might help?

Git repository with multiple users on Ubuntu

I have an existing bare git repository located in /home/myaccount/git/project. I am currently using it over ssh from my local machine without any problems. I want to add a second user on the server which only shall access to this git repository (maybe move the repo outside my account folder?). How? Using latest version of git and ubuntu on slicehost.
I have this setup:
user: sleepyhead
user: developer1
group: git. both sleepyhead and developer1 are members of this group
repository /home/sleepyhead/git/project1
I want to:
move repository to a proper place, either /home/git/project1 or /usr/local/git/project1. What is recommended?
developer1 should permissions to read and write project1 with git. no other permissions should be given.
I do not know how to properly set the permissions and to restrict developer1 to only have access using git to project1.
Have him create a ssh keypair and send you the public key.
Add the public key to your ~/.ssh/authorized_keys file, and add the command="..." option to limit it to the git-shell - see this link for an example.
Orip's answer is probably all you need. If you want something a little more automated you might want to look at gitosis
You will also probably want to have both of those users in the same user group, and to make sure you have group-write privileges on the repository.

Resources