Thursday, 15 September 2011

shell - Get current Git remote on my Bash code -



shell - Get current Git remote on my Bash code -

how can current remote post-receive hook?

i need both current remote , current branch:

i know how current branch (using: branch=$(git rev-parse --symbolic --abbrev-ref $1) ) but don't know how current remote.

any suggestions?

a post-receive hook on server side (the side referenced remote url).

as such, hook has no notion of "remote": has no knowledge how repo in has been accessed.

any git config branch.$branch.remote command wouldn't work on server upstream side, since remote set on client downstream repo.

the op omar chacin adds in comments:

basically trying deploy dozens of websites (each website has develop , master branch).

the thing know how select branch want, how can website want deploy? let's have 3 websites want deploy separately. how can force either master or develop branch 1 of these websites (using unc)?

thus usual solutions involve:

having 1 branch per destination repo (that way, name of branch lone plenty hook checkout in right target site) or: force commit has in commit message relevant info (which target site consider) or: having n bare repos, each post-receive hook: way, force right bare repo url, upstream remote repo in turn update right live site.

i go lastly solution, unc (remote) used client create explicit intended target site updated on server.

git shell githooks

No comments:

Post a Comment