[kwlug-disc] git remote add ...

Chris Frey cdfrey at foursquare.net
Sun May 15 02:31:48 EDT 2022


On Sat, May 14, 2022 at 04:09:02PM -0700, Ronald Barnes wrote:
> I have some local git repos that I wish to keep as "origin".
> However, I also have copies of these repos on GitHub.
> 
> When I clone a repo, I can run:
> git add remote github git at github.com...
> and then I can git push to origin and / or to github.
> 
> Problem is, when I later re-clone from origin, my secondary remote info is
> lost.
> 
> What am I doing wrong?

Nothing.  It just doesn't work the way you expect.

Git remotes are things that are managed locally. git-clone will setup
origin for you automatically from the remote you cloned from, but that's
it.  Remotes are not shared with the world.  They are your own personal
list of sites that you interact with for this repository.

If you regularly clone from one repo and setup remotes to others, then
I'd suggest a script in the repo that you can run to quickly set them up
as part of the your start up process.

- Chris





More information about the kwlug-disc mailing list