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.
Specify a non-existing pushurl in the remote section of the clone-source repository (called origin) in the file .git/config
. Example:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = <url>
pushurl = www.non-existing-url.com
Or if you don't like editing the config file of the repository you can type:
$ git config remote.origin.pushurl www.non-existing.com
When pushing you'll get an error message like:
$ git push
fatal: 'www.non-existing-url.com' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Of course you'll need to edit the config file of each cloned repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With