简体   繁体   中英

Push a bare git repository to another remote?

I have cloned a git repository using:

git clone --mirror http://example.com/some-big-repo.git

Then I have removed a bunch of binaries using: https://rtyley.github.io/bfg-repo-cleaner/

I would now like to push the resulting repository to a new remote. I have added another remote:

git remote add other http://example.com/new-repo

And next I would do:

git push other

But is that safe to do? I really need to NOT modify the repository I originally cloned from.

Yeah that should work. If you want to play it safe you can use this

git push --repo=other

From the docs:

--repo=>repository<

This option is equivalent to the argument. If both are specified, the command-line argument takes precedence.


>repository<

The "remote" repository that is destination of a push operation. This parameter can be either a URL (see the section GIT URLS below) or the name of a remote (see the section REMOTES below).

Also read http://git-scm.com/docs/git-push

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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