What do raw.githubusercontent.com URLs represent? - github

I want to learn how to use rawgit.com to serve other applications from github.com.
So we have a usual way to download and install homebrew on osx.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I can't find the install file on GitHub. Where is it?

The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that's where you'll go.
The URL in your question references the install file in the master branch of the Homebrew/install repository. The rest of that command just retrieves the file and runs ruby on its contents.

There are two ways of looking at github content, the "raw" way and the "Web page" way.
raw.githubusercontent.com returns the raw content of files stored in github, so they can be downloaded simply to your computer. For example, if the page represents a ruby install script, then you will get a ruby install script that your ruby installation will understand.
If you instead download the file using the github.com link, you will actually be downloading a web page with buttons and comments and which displays your wanted script in the middle -- it's what you want to give to your web browser to get a nice page to look at, but for the computer, it is not a script that can be executed or code that can be compiled, but a web page to be displayed. That web page has a button called Raw that sends you to the corresponding content on raw.githubusercontent.com.
To see the content of raw.githubusercontent.com/${user}/${repo}/${branch}/${path} in the usual github interface:
you replace raw.githubusercontent.com with plain github.com
AND you insert "blob" between the repo name and the branch name.
In this case, the user is "Homebrew", the repo is "install", the branch name is "master" (which is a very common branch name). You insert "blob" between "install" and "master", so
https://raw.githubusercontent.com/Homebrew/install/master/install
becomes
https://github.com/Homebrew/install/blob/master/install
This is the reverse of finding a file on Github and clicking the Raw link.

raw.githubusercontent.com/username/repo-name/branch-name/path
Replace username with the username of the user that created the repo.
Replace repo-name with the name of the repo.
Replace branch-name with the name of the branch.
Replace path with the path to the file.
To reverse to go to GitHub.com:
GitHub.com/username/repo-name/directory-path/blob/branch-name/filename

Related

Jekyll/Github site does not show correct sample blog post on Github

I am running Windows 10 with GitHub Desktop. I installed Jekyll and tried to create a test blog.
I started with the instructions at:
https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll
I created the repository in GitHub Desktop and immediately published it to Github.com.
When I use GitHub Desktop to "open in bash" as mentioned in the link above, I get sent to:
E:\codingPractice\DocSourceBlog\DocSourceBlog>
Following the suggestions in the link above, I enter:
E:\codingPractice\DocSourceBlog\DocSourceBlog>mkdir docs
E:\codingPractice\DocSourceBlog\DocSourceBlog>cd docs
E:\codingPractice\DocSourceBlog\DocSourceBlog\docs>git checkout --orphan gh-pages
I enter $ jekyll new . and I get
New jekyll site installed in E:/codingPractice/DocSourceBlog/DocSourceBlog/docs.
I edit the gemfile, comment out the "gem jekyll" and change the next line to
gem "github-pages", "~> 214", group: :jekyll_plugins
by substituting the current version number into the boilerplate of the above link.
I run bundle update and bundle exec jekyll serve and localhost:4000 shows the expected site, including a sample blog post that can be accessed by clicking "Welcome of Jekyll!" That sample blog post starts off with:
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways,
I use GitHub Desktop to commit the changed files to the branch and publish the branch to GitHub.
I refer to instructions at:
https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#choosing-a-publishing-source
I go to github.com/longarchivist/DocSourceBlog/settings/pages and set the source to "gh-pages" and "docs"
I go to https://longarchivist.github.io/DocSourceBlog/ and see that some of the content is there, but the blog post does not seem to show up as expected at "Welcome to Jekyll!" I click the link and get to
https://longarchivist.github.io/jekyll/update/2021/04/18/welcome-to-jekyll.html
but that has the 404 page.
I check the github web interface to make sure that the "_posts" directory is there.
I noticed that the address of the "Welcome to Jekyll!" link was:
http://localhost:4000/jekyll/update/2021/04/18/welcome-to-jekyll.html
I can speculate that ruby somehow destroyed the correct Jekyll configuration when I tried bundle exec jekyll serve but if that was enough to break the system then the documentation seems to be badly misleading.
I tried editing the config file. The "baseurl" variable is now "/docs" and the link address is
https://longarchivist.github.io/docs/jekyll/update/2021/04/18/welcome-to-jekyll.html
However, the desired sample blog post still does not display. Instead
https://longarchivist.github.io/docs/jekyll/update/2021/04/18/welcome-to-jekyll.html
is still a 404 page.
So the localhost problem is not the key to the problem.
Any constructive criticisms would be appreciated.
The best way seems to be to start a root directory that must contain your username first, then start a separate project directory for each project.
After creating a project directory, use "jekyll build" to auto-generate a Jekyll site. Add posts manually in the posts directory: somehow the index finds them automatically.
Then go back to the root site and manually add a link to your project directory.
For example:
https://longarchivist.github.io/
links to
https://longarchivist.github.io/codediary/
which currently has two posts. I created the second post by copying the original, then renaming it. Jekyll apparently expects the post filename to have the correct day and month, so when I use this tactic in the future, I will have to update those manually.

Download single file from remote branch

Is there a way to download a single file from a specific branch of Git Remote repository?
Repo_URL:https://test.ghe.com/repo.git
Branch:release
Git relative file path: repo/file01.txt
There are many related threads however in none gives idea about how to use a specific Git remote branch.
Please help.
Thanks.
Kumarjit
To get the raw URL for your file, follow below steps.
1) Open your repo and required branch in github website.
2) Navigate to the folder containing your desired file.
3) On top of the file, you see "Raw" button.
4) Click on that and you see the raw URL in address bar.
5) You can use this URL to download the file, for example using curl.
However, I'm not sure about your use case, but it is always better to use git pull to get the file.
Hope this helps!

Fossil-SCM Pulling only a specific file

I was trying to pull only a specific file from the fossil scm but the only reply I got was
Fossil internal error: repository does not exist or is in an unreadable directory: blahblah
the commands I tried to use was
fossil pull "file" -R "http://user#ip/folder/to/fossil"
fossil pull "" -R "http://user#ip/folder/to/fossil/file"
I don't understand the documentation. If I wanted to just download a specific file without opening and cloning the repo, how would I do that?
You can't pull a single file from a fossil server. Pulling retrieves ALL the (new) changes in the remote repository into your local repository. It's the read part of the sync command, and it requires you to have cloned the repository first. (The -R command-line option always indicates a local repository).
But it seems to me that what you want, is simply to download a specific file from the remote repository. To do that, just use your browser to navigate the fossil server's web site (I'm using Fossil's own source code repository as an example):
http://fossil-scm.org/fossil/dir?ci=trunk
http://fossil-scm.org/fossil/tree?ci=trunk
and click on the file you want. On the page displaying the file, there's a Download button which will let you download that version of that specific file.
If the file is not text or HTML, you can just download the file using http, using a so-called documentation URL:
http://<server>/doc/<version>/<path-to-file>
For example, let's say you want to download the trunk version of the file www/concept1.gif from the main Fossil repository. That can be achieved by downloading the following URL:
  http://fossil-scm.org/fossil/doc/trunk/www/concept1.gif
That URL is composed as follows:
http://fossil-scm.org/fossil is the repository's location;
/doc/ indicates that you want to access the repository's files directly;
trunk indicates the check-in you want to access. This can also be a check-in identifier (like e319e8e870) or a tag (like pending-review). If you specify a tag or branch name, you'll get the file associated with the last check-in with that tag, respectively in that branch;
/www/concept1.gif is the path within the repository to the file you want to access.
Note that if the file you requested is a wiki, text, or HTML page, fossil will add its header and footer to it.

Problems with my Cydia repo

I am hosting a personal repo for my friends. I am using the cyman script to generate and maintain the repo. I have my repo hosted at http://184.95.54.221/ The problem is that on the iphone when you go into the repo you cannot see the packages and the packages cannot be found. However they are still "listed". You're welcome to install the repo to look.
Make sure your repo has the file called packages.gz
You can create it using the command
dpkg-scanpackages -m . /dev/null >Packages
Your 'Packages' file is invalid. Name, Author, Depiction, Icon - these fields has indentation at the beginning of a line. Remove it and Cydia will see your packages.

Using GitHub to listen to changes made to files on remote server

I know there are a lot of posts about running GitHub on a remote server, but I can't find any that I understand or can follow. Command line stuff and all this talk about SSH completely befuddle me, so I am hoping for a step-by-step answer which is literally written for a dummy and hopefully provides an easy solution (I am having my fingers and toes crossed).
My scenario:
I have built a site using Statamic as a CMS, which uses text files to manage the site's content. I also have a GitHub repository which contains most of the site's files here:
https://github.com/katrinkerber/katrinkerber
I am using the GitHub app on OSX to push any changes I make to, for example, my local CSS or HTML files to the remote Github repository. That is as far as my basic understanding of Git takes me really.
Whenever existing content is edited or a new page/entry is published through the CMS's Control Panel, a file is updated or created inside the *_content* folder on the server where the site is hosted.
What I want is for Github to listen to and keep track of any changes made on the server, particularly that *_content* folder.
One of my attempts was to just upload the .git folder in my local files to my server and change the Primary remote repository path, but that didn't work.
What do I need to do?
Really the only way to run Git (the version control system, not GitHub the web application/network) is via SSH.
Here's a good article: http://git-scm.com/book/en/Getting-Started-Installing-Git#Installing-on-Linux
And if you get that up and running, here's a good way to set up deployments: http://blog.ekynoxe.com/2011/10/22/automated-deployment-on-remote-server-with-git/