Okay so I've seen this as a similar question several other places on here but many of those are multiple years old and have not seen a satisfactory answer on any of them. Github Raw File - Can I get a permanent link? and Read Raw Contents of File in Private Repo on Github via access_token
First let me provide my use case as I am open to alternative solutions.
I need to be able to link/display markdown files (.md) that are part of a private github repo in confluence. This does technically work using the confluence plugin Markdown from url when giving it a raw url like raw/repo/readme.md?token=XXXXXXX. The issue is the token generated via looking at the raw link is only valid for 7 days so this will not really work for documentation as obviously after a week part of the doc will no longer be visible. As referenced in one of the links above and several other places online through a google search I see the claim that it should be possible to generate a personal access token and substitute the token ie raw/repo/readme.md?token=PERSONAL_ACCESS_TOKEN but I have not found this to be the case. Even when granting your PAT every permission you can in github this still results in a 404 when attempting to access the url in a browser or through the confluence plugin.
Additionally I've also seen an example with a username like raw/repo/readme.md?login=USERNAME&token=PERSONAL_ACCESS_TOKEN but alas this has the same result of receiving a 404.
So the question is does anyone know how to make this work successfully using a PAT or similar security alternative? Am I missing a url option that would make it happy?
Please note I am NOT looking for alternative confluence plugins to make this happen, I know there are several but due to organizational security concerns these are not really options in my case.
Thanks for any ideas
1. You need to generate a Personal Access Tokens.
According to this GitHub help page:
Let's suppose your actual token is 1234567abcdefg
2. Embed Token into the link.
As you see, "?token=SOME_NUMBERS_LETTERS" are removed. Insert the token you generated from GitHub + @ right after "https://"
curl -s -O https://[email protected]/GITHUB_ACCOUNT/REPOSITORY_NAME/BRANCH_NAME/FILE_NAME.EXTENTION_NAME
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With