You are not logged in.

#1 2009-06-03 11:29:21

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Need help setting up a Git server.

Been following this guide. But it is missing a part regarding SSH support. When I add a locale server, IP-based. It gives me some error about line length and access denied. I suspect that it tries to connect with the wrong user, or something. I have a password on the git user, since it can't be blank.

Could anyone help me with this. I plan on update the with what I learn here. Adding a locale Git server with SSH support.
The server is updated with the latest software. We use a static IP, and SSH is working perfectly.

Ed1t: Fixed typo in subject.

Last edited by MindTooth (2010-02-09 13:18:16)

Offline

#2 2009-06-04 02:27:01

darthaxul
Member
Registered: 2008-09-24
Posts: 156

Re: Need help setting up a Git server.

yea, that link does not tell u anything about setting up git, find the manual, thats what u prolly need. http://www.kernel.org/pub/software/scm/ … anual.html

Offline

#3 2009-06-04 02:32:36

shakin
Member
Registered: 2008-08-07
Posts: 24

Re: Need help setting up a Git server.

The first thing to realize is that git works on directories. Network protocols are really just to get access to the remote directory that contains the git repository.

Let's say you've got a ~/code directory.

Enter dir: cd ~/code
Create a file: touch oldfile
Init repo: git init
Add oldfile: git add oldfile
Commit oldfile: git commit -a

Now you're ready to clone the repo. We'll do it locally for easy testing.

Move to home dir: c d~
Clone it to another dir: git clone ~/code clone

Now you've got a ~/clone directory (and repository) that is a clone of the ~/code repository. There is a file named oldfile there (so you know the clone worked)

Now in ~/clone you can create a file: 'touch newfile'.
Add it to be tracked: 'git add newfile'.
Commit the change: 'git commit newfile' OR 'git commit -a' (to commit all changes, which is just this one in this case)
Now push it to the original ~/code repo: 'git push'

Now anytime you pull or clone from the repo you'll get both oldfile and newfile because they are both in the repo (newfile won't show up in the ~/code directory, though) That's really all there is to git at its most basic level. You clone, edit/add files, commit locally, then push to the server.

So now that you've got your repo working you want remote access. If you can ssh into the computer hosting the ~/code repo then you've already got remote access. Use the username of the user whose home directory ~/code resides in (you can worry about real permissions later, as that's a Linux question, not a git question).

From remote computer, clone the repo:

cd ~
git clone ssh://remoteuser@remoteserver/home/remoteuser/code code

Now you have a local ~/code repo and working directory. We operate on it just like we did when we created the ~/clone repo on the other computer. You'll have files named oldfile and newfile if you followed the steps earlier. Let's work on this remote repo:

Create a new file: touch hello.c
Add it to be tracked by git: git add hello.c
Commit: git commit -a
Push to server: git push

That's it. The server will have hello.c. If somebody else updates the server you can run 'git pull' to get those changes. Anybody else who runs 'git pull' or clones the repo will have your hello.c

Simple? Yes!

Please note that my example is a very simple setup and you may need something more complex, but once you've got the basics it's not hard adding one or two more commands to do exactly what you want.

Offline

#4 2009-06-04 13:28:07

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need help setting up a Git server.

Thank you so much for explaining. This you should clean up, and paste in the wiki.
But the problem is that I can't seem to get into the remote server. Because the authentication will not pass. Because I can't sett blank password I guess.

@darthaxul: I have red the manual on git-scm.org, but no help on remote server hosting.

Birger smile

Offline

#5 2009-06-04 14:06:39

shakin
Member
Registered: 2008-08-07
Posts: 24

Re: Need help setting up a Git server.

MindTooth wrote:

Thank you so much for explaining. This you should clean up, and paste in the wiki.
But the problem is that I can't seem to get into the remote server. Because the authentication will not pass. Because I can't sett blank password I guess.

@darthaxul: I have red the manual on git-scm.org, but no help on remote server hosting.

Birger smile

Git tunnels over SSH, so it's just like SSHing into the server.

Eg.

ssh user@server == git clone ssh://user@server/file/path == scp user@server:/file/path

If one works they all work because it's the same user, same password and same protocol. Make sure you can ssh in normally with that user and make sure that user owns the git repository (or has rw permissions on it).

Offline

#6 2009-06-04 15:42:06

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Need help setting up a Git server.

Thank you for explaining it this far big_smile Will try it once more, and post the error.

Birger smile

Offline

Board footer

Powered by FluxBB