简体   繁体   English

如何在git中将遥控器推到裸仓库

[英]How to push and pull remotes to bare repository in git

I have my local repository with the "origin" remote configured ("origin" is a bare repository). 我在本地存储库中配置了“源”远程(“源”是一个裸存储库)。 I also have some other remotes configured. 我还配置了其他一些遥控器。 Is it possible to push my configured remotes (the names and the adresses, not the content) to the "origin". 是否可以将我配置的遥控器(名称和地址,而不是内容)推送到“来源”。

The intention is that if somebody clones the project from the "origin" that he automatically has all the other remotes configured like I have. 目的是,如果有人从“来源”克隆项目,他将自动像我一样配置所有其他遥控器。 Or do I have to add all remote repositories automatically after each clone? 还是我必须在每个克隆之后自动添加所有远程存储库?

You can't control someone else's repository. 您无法控制其他人的存储库。 Push access to the content of a repository isn't the same thing, at all, as administrative control. 推送访问存储库的内容与管理控制完全不是一回事。 To get that, you need access to the repository's filesystem. 为此,您需要访问存储库的文件系统。 As the repository administrator you could grant controlled remote access to its configuration by setting up a post-receive hook to look for eg files pushed to a special branch name and have its way with whatever it finds there. 作为存储库管理员,您可以通过设置接收后挂钩来查找例如被推送到特殊分支名称的文件并对其进行处理的方式来授予对其配置的受控远程访问。

Perhaps the easiest thing would be to supply a "append-me-to-config-in-the-.git-directory" file with the [remote "whosis"] sections included, all set up for them. 也许最简单的方法是提供一个“附加到我的.git目录中的配置文件”文件,其中包含[remote "whosis"]节,所有这些节均已设置好。 Or you could put the necessary config commands in the README so doing the setup is 'V}!sh' in vi or however you get your editor to run commands on buffer contents. 或者,您可以在自述文件中放入必要的配置命令,以便在vi中进行设置为“ V}!sh”,或者让编辑器在缓冲区内容上运行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM