Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Copying a Wiki

mikerb May 31, 2021

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.

2 answers

1 accepted

0 votes
Answer accepted
mikerb June 2, 2021

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.

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 1, 2021

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.

Kind regards,
Theodora

mikerb June 2, 2021

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?

mikerb June 2, 2021

See my answer, your answer pointed me in the right direction, thank you

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2021

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

https://<username>@bitbucket.org/<workspace-id>/<repo>.git/wiki

The URL

https://<username>@bitbucket.org/<workspace-id>/<repo>

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events