Domanda

Can I push remotes so that if someone clones the repo, the remotes are included and therefore already set up for them?

It seems that a standard git push doesn't do this.

The git docs here hint that this is possible:

If you’ve cloned your repository, you should at least see origin

But I see nothing in the dos for remote here or push here.

È stato utile?

Soluzione

No. origin is automatically created when you clone, pointing to the clone URL, but that's it. In your own local repository, remotes are stored in .git/config; the only thing in .git that is ever transmitted is your history.

If you want to provide others with useful configuration, your best bet is to put it on a supplemental website or add a small script to your repository that others can execute to add configuration. Example:

#!/bin/sh
git config remote.blargh.url https://...
git config remote.blargh.fetch +refs/heads/*:refs/remotes/blargh/*
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top