Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
推送时从远程git repo发送消息_Git - Fatal编程技术网

推送时从远程git repo发送消息

推送时从远程git repo发送消息,git,Git,通常,当我推进git回购时,我会得到如下输出 $ git push origin somefeature Counting objects: 42, done. Delta compression using up to 8 threads. Compressing objects: 100% (42/42), done. Writing objects: 100% (42/42), 13.39 MiB | 2.69 MiB/s, done. Total 42 (delta 5), reused

通常,当我推进git回购时,我会得到如下输出

$ git push origin somefeature
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (42/42), done.
Writing objects: 100% (42/42), 13.39 MiB | 2.69 MiB/s, done.
Total 42 (delta 5), reused 0 (delta 0)
To github.com:greggman/someproject.git
 * [new branch]      somefeature -> somefeature
但是,在几个月的某个时候,当我推到github时,我看到了这些
remote:
消息

$ git push origin somefeature
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (42/42), done.
Writing objects: 100% (42/42), 13.39 MiB | 2.69 MiB/s, done.
Total 42 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
remote: 
remote: Create a pull request for 'somefeature' on GitHub by visiting:
remote:      https://github.com/greggman/someproject/pull/new/somefeature
remote: 
To github.com:greggman/someproject.git
 * [new branch]      somefeature -> somefeature
我如何通过自己的git回购实现这一点?比如说

remote: Hello World
换句话说,假设我在
ssh://freerepos.com
。你打字

git clone ssh://freerepos.com/some/repo.git
然后进行一些更改,提交并键入

git push origin master
如何配置我的回购,使其打印

remote: Hello World

在您的终端中,当您推送到我的机器时,就像我推送到github的机器时,github当前插入远程输出一样?

添加一个
更新后
钩子可以做到这一点

cat > .git/hooks/post-update
#!/bin/sh
echo "hello world"
导致

$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 245 bytes | 245.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: hello world
To /Users/me/temp/delme-git/pub-repo
   deae6fa..4d3d769  master -> master
这是通过使用

标准输出和标准错误输出都被转发到另一端的git send pack,因此您可以简单地为用户回显消息


这些消息似乎来自所有的repo。是的,它们来自github,但我在本地使用git,因此git显然有一些协议允许远程端将消息发送回本地。我的问题是如何利用该协议。