Can I send out-of-band data along with commit?

I want to integrate a remote git repository with an RTC server using their RESTful interface to attach a link to gitweb for commit related to a specific task.

Ideally, this will be done with a post-receive hook on the git server, but the processing user who runs git is not allowed for the user account for authentication in RTC.

The best solution I can think of is to somehow pass the authentication token (acquired from RTC as a cookie.txt) along with pressing git (but not having it part of the commit).

An alternative would be a post-push hook in each client repository, but it has its own problems (including that there is no such hook).

+4
source share
1 answer

With git version 2.10 and higher, you can use git --push-option <string> to send the given string value to the server, which sends them for preliminary reception, as well as for reception after reception. git click documentation .

The number of push options specified on the command line git push --push-option = ... can be read from the GIT_PUSH_OPTION_COUNT environment variable, and the parameters themselves are found in GIT_PUSH_OPTION_0, GIT_PUSH_OPTION_1, ... If this is due to the fact that the phase is not used push options, environment variables will not be set. If the client chooses to use push options but does not pass them, the count variable will be set to zero, GIT_PUSH_OPTION_COUNT = 0. git hook documentation

+4
source

Source: https://habr.com/ru/post/1492693/


All Articles