3

I would like to set a GIT server and let my developers to login using username and password in order to commit and make changes to the projects. I need also to manage developer access to projects (I think I should use gitolite for this).

How can I do that?

I am used to SVN which is easy because you can set username and password for each developer, which can easily access the repository without having the generate an ssh key and put it on the server.

Thanks

Giorgio
  • 31
  • 1
  • 2

4 Answers4

2

Perhaps you aren't aware of this, but Git is a distributed VCS. Thats essential to your understanding. OTOH SVN and CVS are centralized. You can still have a central repository in Git, and if you do, your users will need to be able to log into that server using SSH or HTTP access, look it up. Generally speaking, Git depends on the server's authentication.

So to make a git repo on a Debian or Ubuntu server for centralized use:

# apt-get install git
# cd /var/git
# git init --bare myreponame.git
# adduser <username>    as needed

At this point you have an empty repo. To clone it to your desktop Debian or Ubuntu:

For SSH connections: look up ssh keygen and set up a passwordless connection to your server- keygen and sharing is only two commands.

To clone a repo:

$ git clone <server>:/var/git/myreponame.git

$ cd myreponame

Now you can add files and directories... when you have used git add and git commit, then you can use git push to push commits to the central repo.

  • There are non-bare repositories, you must read up on this, use the standard Git references, just Google.
  • Warning a "shared repository" is not what you think from the name.
John P. Fisher
  • 470
  • 4
  • 9
  • I might add something about managing what users have access to what repos with filesystem permissions and softlinks for folders. Personally, I like the PR flow on github instead of managing something in house, but clearly the OP doesn't understand how git works. – RobotHumans Aug 03 '18 at 23:45
0

gitolite uses public key authentication, and FWIW, you don't need to generate everybody's key pairs. Just ask them for the public key.

The configuration in gitolite is just another repository, you just need to grant access and add the public keys accordingly.

dawud
  • 14,918
  • 3
  • 41
  • 61
0

I would like to set a GIT server and let my developers to login using username and password in order to commit and make changes to the projects. I need also to manage developer access to projects

I would suggest to use GitLab Community Edition. As it has all features that you need and many more.

I am used to SVN which is easy because you can set username and password for each developer, which can easily access the repository without having the generate an ssh key and put it on the server.

actually ssh key is very comfortable, because you don't need to enter login/password every time as you want to clone/pull/push/etc.

Any way with gitlab you can use login/password and/or ssh key.

ALex_hha
  • 7,025
  • 1
  • 23
  • 39
  • Yes I think SSH key is comfortable but actually for a windows developer with no experience with SSH keys it would be a little bit tricky. – Giorgio Jun 08 '14 at 17:41
  • I had problem on installing Gitlab in debian wheezy using the deb package, I should try the manual installation. – Giorgio Jun 08 '14 at 17:43
  • I have installed and running gitlab on CentOS-6.5 without any problem. Manual installation it's a bad idea, imho. At least if you didn't work with Gitlab before. – ALex_hha Jun 09 '14 at 15:23
  • I manually installed it and it works fine. The only problem is the memory consumption which is crazy, almost 500MB!! – Giorgio Jun 09 '14 at 16:03
0

If you want password authentication via SSH and authorization via Gitolite, you can easily do this.

Basically what you do is, you create an account for each user and put them in a group, or you apply the following Match to all users and make exceptions for ones that should be able to actually log in. For my example I assume you stuff all git users into the group git-users, the hostname is git, Gitolite is operating as user git and Gitolite is installed at /opt/gitolite. IF anything is not true, just adapt the instructions

In /etc/ssh/sshd_config you would have

Match Group git-users
    X11Forwarding no
    AllowTcpForwarding no
    AllowAgentForwarding no
    PermitTTY no
    ForceCommand sudo -u git -H /opt/gitolite/src/gitolite-shell $USER

to give control to Gitolite if a user connects and to tell it which user it is.

And that this sudo command works without password you do visudo and there in the sudoers file add

Defaults!/opt/gitolite/src/gitolite-shell       env_keep+=SSH_CONNECTION
Defaults!/opt/gitolite/src/gitolite-shell       env_keep+=SSH_ORIGINAL_COMMAND

to forward SSH_CONNECTION and SSH_ORIGINAL_COMMAND environment variables which Gitolite needs to operate properly and

%git-users      git = (git) NOPASSWD: /opt/gitolite/src/gitolite-shell

which says in order that every user in the group git-users is allowed to execute on the host named git as user git without specifying a password the command /opt/gitolite/src/gitolite-shell.

Vampire
  • 111
  • 2