推送时从远程git repo发送消息
通常,当我推进git回购时,我会得到如下输出推送时从远程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 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显然有一些协议允许远程端将消息发送回本地。我的问题是如何利用该协议。