通常,当我推送到git repo时,我会得到这样的输出
$ 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 repos完成此操作?例如
remote: Hello World
换句话说,假设我在ssh://freerepos.com
上建立了一个您要使用的公共存储库。您输入
git clone ssh://freerepos.com/some/repo.git
然后进行一些更改,提交并输入
git push origin master
如何配置我的仓库以使其打印
remote: Hello World
当您按入我的机器时,是否在终端中以github当前当我按入其机器时插入远程输出的方式?
答案 0 :(得分:2)
这是通过server-side git hooks完成的。
标准输出和标准错误输出都转发到另一端的git send-pack,因此您可以简单地为用户回显消息。
答案 1 :(得分:0)
添加一个post-update
钩子即可
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