GIT server with username and password authentication

8,452

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.
Share:
8,452
Giorgio
Author by

Giorgio

Updated on September 18, 2022

Comments

  • Giorgio
    Giorgio over 1 year

    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
    Giorgio almost 10 years
    I had problem on installing Gitlab in debian wheezy using the deb package, I should try the manual installation.
  • ALex_hha
    ALex_hha almost 10 years
    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.
  • Giorgio
    Giorgio almost 10 years
    I manually installed it and it works fine. The only problem is the memory consumption which is crazy, almost 500MB!!
  • RobotHumans
    RobotHumans almost 6 years
    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.