Skip to content

Commit

Permalink
Merge pull request progit#567 from YueLinHo/i312
Browse files Browse the repository at this point in the history
Fix issue progit#312: /srv/git instead of /opt/git for server repositories
  • Loading branch information
ben committed Mar 16, 2016
2 parents 761be20 + 62e5d0a commit ec75603
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions book/04-git-server/sections/git-on-a-server.asc
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@ It takes the Git repository by itself, without a working directory, and creates
==== Putting the Bare Repository on a Server

Now that you have a bare copy of your repository, all you need to do is put it on a server and set up your protocols.
Let's say you've set up a server called `git.example.com` that you have SSH access to, and you want to store all your Git repositories under the `/opt/git` directory.
Assuming that `/opt/git` exists on that server, you can set up your new repository by copying your bare repository over:
Let's say you've set up a server called `git.example.com` that you have SSH access to, and you want to store all your Git repositories under the `/srv/git` directory.
Assuming that `/srv/git` exists on that server, you can set up your new repository by copying your bare repository over:

[source,console]
----
$ scp -r my_project.git [email protected]:/opt/git
$ scp -r my_project.git [email protected]:/srv/git
----

At this point, other users who have SSH access to the same server which has read-access to the `/opt/git` directory can clone your repository by running
At this point, other users who have SSH access to the same server which has read-access to the `/srv/git` directory can clone your repository by running

[source,console]
----
$ git clone [email protected]:/opt/git/my_project.git
$ git clone [email protected]:/srv/git/my_project.git
----

If a user SSHs into a server and has write access to the `/opt/git/my_project.git` directory, they will also automatically have push access.
If a user SSHs into a server and has write access to the `/srv/git/my_project.git` directory, they will also automatically have push access.

Git will automatically add group write permissions to a repository properly if you run the `git init` command with the `--shared` option.(((git commands, init, bare)))

[source,console]
----
$ ssh [email protected]
$ cd /opt/git/my_project.git
$ cd /srv/git/my_project.git
$ git init --bare --shared
----

Expand Down

0 comments on commit ec75603

Please sign in to comment.