How to get direct link or direct link to github files ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get direct link or direct link to github files ?

I have uploaded some css code. I want to get the direct link to it https://github.com/akash-profile/Libraries/blob/main/Material-icons/material-icons.css I tried ( https://github.com/akash-profile/Libraries/Material-icons/material-icons.css ). But all in vain. Please help me 😭

20th Aug 2022, 6:59 PM
Akash Kumar
Akash Kumar - avatar
4 Answers
+ 2
The simplest way is to add "?raw=true" at the end of the link to your file. It redirects you to the "raw.githubusercontent.com" site. Now, it depends on how you want to use it. If you want to embed the CSS file into an HTML Webpage (or a similar case) then better use the link it redirects you to (open the edited link in your browser and copy the new URL). In case you need an example of what to expect: https://github.com/akash-profile/Libraries/main/Material-icons/material-icons.css?raw=true redirects you to https://raw.githubusercontent.com/akash-profile/Libraries/main/Material-icons/material-icons.css .
20th Aug 2022, 7:08 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
When you apply the "raw" argument to the "raw.githubusercontent.com" file, the server returns a "text/plain" file with the content "404: Not Found" instead.
21st Aug 2022, 5:03 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
#0009e7 [get] Could you correct the link You talked about raw files I got this link ( https://raw.githubusercontent.com/akash-profile/Libraries/main/Material-icons/material-icons.css ) also tried yours ( https://raw.githubusercontent.com/akash-profile/Libraries/main/Material-icons/material-icons.css?raw=true ) When I use it in my html code it says refused to apply styles because MIME type is text/plain strict checking is enabled.
21st Aug 2022, 1:01 AM
Akash Kumar
Akash Kumar - avatar
+ 1
I will check that. But first, note that the "?raw=true" is only applied to the first link ("github.com"). The "raw.githubusercontent.com" should not have it, even just to make sure that it does not do something wrong. It should already be a raw, or plain, file.
21st Aug 2022, 4:59 PM
#0009e7 [get]
#0009e7 [get] - avatar