Skip to content

Commit b335281

Browse files
committed
customizable server login
1 parent 0544e07 commit b335281

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,22 @@ test_srv:
4242
volumes:
4343
- /srv/git:/srv/git
4444
- logs:/var/log/nginx
45+
# add your custom username and password (default is: admin, admin)
46+
- ./htpasswd:/srv/htpasswd
4547
# if you want to use a custom configuration
4648
- ./default.conf:/etc/nginx/conf.d/default.conf
4749
environment:
4850
GIT_POSTBUFFER: 1048576
4951
```
52+
53+
Test it:
54+
55+
```shell
56+
git clone http://localhost:8180/myrepo.git
57+
```
58+
59+
Default username and password are admin/admin. I strongly suggest you to update the htpasswd file with your password, like so:
60+
61+
```shell
62+
htpasswd htpasswd admin
63+
```

default.conf

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ server {
2020
fastcgi_param GIT_HTTP_EXPORT_ALL "";
2121
fastcgi_param GIT_PROJECT_ROOT /srv/git/;
2222

23+
auth_basic "Restricted";
24+
auth_basic_user_file /srv/htpasswd;
25+
fastcgi_param REMOTE_USER $remote_user;
26+
2327
fastcgi_pass unix:/var/run/fcgiwrap.socket;
2428
}
2529

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ test_srv:
55
volumes:
66
- /srv/git:/srv/git
77
- logs:/var/log/nginx
8+
# add your custom username and password (default is admin, admin)
9+
- ./htpasswd:/srv/htpasswd
810
# if you want to use a custom configuration
911
- ./default.conf:/etc/nginx/conf.d/default.conf
1012
environment:

htpasswd

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
admin:$apr1$SU8d4HhK$n.3vMyw23lJ82sxFQAQzF.

0 commit comments

Comments
 (0)