I wish to copy a wiki from one repository to another. I have created a git repository on my machine and cloned the wiki. I have created the new repository and wish to upload the contents to the new wiki. The new repository has a wiki defined with the default home.md page.
I am trying to set up the remote for git for the new repository but am getting stuck. I configure the remote URL with //https:/bitbucket.org/<user name>/<repository name>/Wiki and then I get stuck, what is the mapping for the wiki head version? I have my Git branch as HEAD but I need a mapping for the remote.
The documentation says that the wiki is a repository but what is the mapping for uploading?
Any pointers appreciated.
I have worked it out. I did a fetch first which created the link between my local repository and the remote. I then added my files from the old Wiki to my local repository and the upload worked.
When adding a remote I had to make sure that I used the default branch name from when the repository was set up in the mapping.
Hi @mikerb ,
I believe that the push will fail because the wiki in the second repo already has a commit with the default page, and its history is not related to the history of the wiki you are trying to push from.
If the new wiki contains only the default page, and no other commits/changes you want to keep, what you can do is force push from your local repo (of the wiki you want to copy) to the new wiki.
Please note that the force push will remove the existing history of the new wiki, and will replace it with the history of your local clone.
So, in your local clone of the wiki you want to copy, you can do the following:
git remote add second-wiki URL-of-new-wiki
git push -f second-wiki
where second-wiki is the name of the second remote, feel free to replace with a different one.
Please feel free to let me know if you face any issues or if you have any questions.
Thanks for the answer, this I tried and it says it was successful but only uploaded 3 items. Should the remote be the url of the repository or include wiki, eg. https://bitbucket.org/<user>/<repository> or https://bitbucket.org/<user>/<repository>/wiki?
Should my files be in the folder itself or one called wiki?
Hi @mikerb, thank you for the update, I'm glad you were able to figure it out.
Just to answer your question as well, the (HTTPS) URL of the wiki should be
is for the repo that contains the wiki.
You can also find the URL if you open the wiki in Bitbucket website, and then select the Clone wiki link (from the top right corner). This will show you the git clone command along with the URL for this specific wiki.
Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events