Git 禁用从本地存储库推送
我有一个存储库,其中包含一些核心代码,对于每个客户端,我希望克隆它,这样每当客户端想要升级到最新功能时,我就可以执行 git pull 。
为了不把事情搞砸并做出只有一家公司看到的更改,是否有一种方法只允许在本地存储库的基础上进行提取?我仍然希望能够从我的开发环境将更改推送到核心存储库,但不希望生产机器能够推送。
I have a repository with some core code in it, and for each client I wish to clone it so I can do git pull everytime a client wants to upgrade to the newest functionality.
In the interest of not screwing things up and making changes that only one company sees, is there a way to only allow fetches on a local repository basis? I still want to be able to push changes to the core repo from my dev environment, but don't want production machines to be able to push.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在文件
.git/config
的克隆源存储库(称为 origin)的远程部分中指定一个不存在的 Pushurl。示例:或者,如果您不喜欢编辑存储库的配置文件,您可以键入:
推送时,您会收到一条错误消息,例如:
当然,您需要编辑每个克隆存储库的配置文件。
Specify a non-existing pushurl in the remote section of the clone-source repository (called origin) in the file
.git/config
. Example:Or if you don't like editing the config file of the repository you can type:
When pushing you'll get an error message like:
Of course you'll need to edit the config file of each cloned repository.
我发现远程命令更有用,因此我不必直接搞乱配置。
应该也可以
I find the remote command more useful so I don't have to mess with configs directly.
should work as well