简体   繁体   中英

Copying gh-pages branch from one repository to another repository

My GitHub org is https://github.com/Obrary . There, I have 100s of open designs for products. Each is a project. I want each to have a GitHub page for the project.

I created a simple GitHub page for one of the projects. See http://obrary.github.io/Alex-Chair/ . The page is created so that I can add it to any projects gh-pages branch and it will work for the new project. To see that in action, http://obrary.github.io/Alexey-Surfboard-Rack/ .

Now I want to copy the gh-pages branch from /Alex-Chair to all my other projects. In going through the help and examples, I've seen a lot of information about copying branches with a repo or copying repos in whole. But I haven't found examples on how to copy a branch from repo A to repo B.

Here's the current command line that I've got. But it fails because the clone command only works at the repo level (or so I think).

    git checkout --orphan gh-pages
    git rm --cached -r .
    git clone --bare https://github.com/Obrary/Alex-Chair/tree/gh-pages

Thanks

Try this:

First make sure there is a gh-pages branch in the repo you want to push to.

From the Alex-Chair gh-pages branch:

git push -f [new repo url] gh-pages

Or, add a new remote like in this answer : (using Obrary/memes as an example)

git remote add memes https://github.com/Obrary/memes
git push --force memes gh-pages

You want to be careful with force , but in this case what you want to do (completely override the upstream with local files) is exactly what force will do.

Hope that helps!

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