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:
Related
I am new to Git and after I lots of searching I found that I must have set Linux permissions in my Git server.
But I want to know, is it possible to set permissions in Git?
I am working on a team about six people and I don't like to everyone on the team can access all the project for security reasons.
For example, If somebody in my team works on UI in my Store section I want to he/she have it's own branch but when he/she PULL the project with Git just have access to files and folders I let.
I have to add that I have my own Git server on a local network using Linux Debian and I'm using "SourceTree" as my GUI for Git and I have few experience on Git command line, so I need do it from GUI if possible.
Edited:
Does Git lab support permission like this: I have a repository that uses Laravel framework and I'd like to set permission for UI developers that only access views and PHP developers access some controllers not all the part of the controller in the project.
You can checkout GitLab: https://about.gitlab.com/ for this. Out of the box git does not support what you need/want.
No, Git doesn't manage this directly. Anyone with authentication credentials to the repository has access to the entire repository.
Traditionally, this is managed with third-party solutions, such as Gitolite, GitHub private repositories, and other systems.
In addition to other answers: if you want only certain parts of project to be accessible to each developer, you can use git submodules.
This is also preferable if project has logically and functionally separate parts. (Like front-end and back-end. )
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.
I used mac github client to push my codes to my github account. On my Ubuntu linux computer I wan't to connect to github using the terminal so that it will automatically sync will all my projects on github. How would I do it? All the online help I have bumped in to so far only show how to clone an exiting git repository not how to connect to my github account and sync it.
git, the revision control system, doesn't know anything about Github, a website that keeps track of and hosts your git repositories for you. The concept of a Github account is totally alien to git, so you'll never be able to, say, browse all of the projects you own on Github with a git command. git only works on the level of individual repositories.
Github also provides a graphical client that handles both the git level stuff and the Github level stuff -- it understands what a Github account is, and will log in for you and display all of the repos associated with the account. It's also a fully featured git client that does a lot of work on the level of individual repos for you. However, this graphical client is currently only available for Windows and OS X, and is not available for Linux.
My own workflow on Linux is to use the github.com website plus the command-line git tool. To bridge the gap between Github and git, you need to git clone individual repos. Aside from that, you can do Github administrative tasks on the website, and you can work with individual repos with git on the command line.
If you don't like this work flow, you need to look at graphical git clients for Linux. I'm not sure if any exist that will do both git-level stuff and also interface with Github specifically and understand the idea of a Github account.
You could also theoretically try to run the Windows client in wine on Linux, but I would not recommend this approach except as a last resort.
First I don't know a program that automatically sync all my github repositories.
First you have to install git (if it has not been done already) tutorial
Than you should generate a rsa:key to be able to 'push' your repositories to github.
You can generate a rsa_key by following this tutorial notes ssh-add id_rsa should be ssh-add id_rsa.pub ....also you can name id_rsa as anything you want: like bran_rsa_key
You should post or add your rsa_key to git hub at this address. If you go to that link you will see that you already have some key for your Mac but nothing for your Ubuntu.
After installation you could install ungit if you're not that familliar with git
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?
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.