You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/configuration/pre-receive.mdx
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
-
# Pre-Receive Hook Documentation
1
+
---
2
+
title: 'Pre-Receive Hook'
3
+
---
2
4
3
5
## Overview
4
6
5
-
The `pre-receive` hook is a critical component of the Git Proxy system. It is executed before changes are accepted into a repository. This hook allows for custom logic to validate or reject incoming changes based on specific criteria, ensuring that only valid and authorized changes are pushed to the repository.
7
+
The `pre-receive` hook is a critical component of the GitProxy system. It is executed before changes are accepted into a repository. This hook allows for custom logic to validate or reject incoming changes based on specific criteria, ensuring that only valid and authorized changes are pushed to the repository.
6
8
7
9
## Functionality
8
10
@@ -17,18 +19,21 @@ The `pre-receive` hook determines the outcome of a push based on the exit status
17
19
18
20
To use the `pre-receive` hook, follow these steps:
19
21
20
-
-**Create a Hook Script**:
21
-
Write a shell script or executable file that implements your custom validation logic. The script must accept input in the format: `<old_commit_hash> <new_commit_hash> <branch_name>`.
22
+
### Create a Hook Script
22
23
23
-
-**Place the Script**:
24
-
Save the script in the appropriate directory, such as `hooks/pre-receive.sh`.
24
+
Write a shell script or executable file that implements your custom validation logic. The script must accept input in the format: `<old_commit_hash> <new_commit_hash> <branch_name>`.
25
25
26
-
-**Make the Script Executable**:
27
-
Ensure the script has executable permissions. You can do this by running the following command:
26
+
### Place the Script
28
27
29
-
```bash
30
-
chmod +x hooks/pre-receive.sh
31
-
```
28
+
Save the script in the appropriate directory, such as `hooks/pre-receive.sh`.
29
+
30
+
### Make the Script Executable
31
+
32
+
Ensure the script has executable permissions. You can do this by running the following command:
33
+
34
+
```bash
35
+
chmod +x hooks/pre-receive.sh
36
+
```
32
37
33
38
> **Note**: If the `pre-receive` script does not exist, the hook will not be executed, and the push will proceed without validation.
0 commit comments