Which will get Priority between "github pages" and "directory kept at root" in case of name conflicts and why - html

Say I have an index.html put on my username.github.io, which I can visit by the url, http://username.github.io
Now consider 2 conflicting cases
Say, I have a repository named repo1 with gh-pages activated. So, it should be available at http://username.github.io/repo1
I also have put a folder named repo1 with an index.html inside it, at the username.github.io location.
Here's my question
Now, if I visit from my browser the url http://username.github.io/repo1 which one of 1 or 2 will be served? and more importantly WHY ?

I tested it with my github repo sumanbarick.github.io.
Finding: Repository (github pages) will get priority in case of name conflict.
Test 1: http://sumanbarick.github.io/test/
First I made a repository name test with an index.html inside it. Created branch gh-pages. I tried the url http://sumanbarick.github.io/test/ and I got the page index.html.
Then I created a folder named test and an index.html inside it in sumanbarick.github.io repo
I hit the url again. But still got he index.html from the repo
Test 2: Does 1st defined gets the 1st priority?
This time I made a folder named test2 and an index.html inside it in sumanbarick.github.io repo. I tried the url http://sumanbarick.github.io/test2/ and I got the page index.html from folder test2
But as soon as I created the repo test2 with gh-pages, the result of the url favored the index page of the repo
So, this is a partial answer. And now we know,
Q. Which one will get priority?
A. The repo (Go to the above mentioned url and see for yourself).
Q. Why?
A. I am still curious about this WHY part. Let's see what others say.

Related

A badge in GitHub template repository that will refer to clones' build status, not the template repo's build status

I'm new to GitHub's template repositories. We've created a template repo for our course's code labs. Let's say it's on GitHub under myorg/labX. The students are using GitHub Classroom, which clones the template repo for each student under myorg/labX-studentlogin. We've got actions to run some tests against their code using GitHub's own CI, and I want to include badges in the repo's README.md to see the test results at a glance. So I know that
![](https://github.com/myorg/labX/workflows/task1/badge.svg)
will include the badge, but this is the status of the template repo, not student repos. Is there a way to automate this so that when the students get their clone, it will contain a README with the URL that refers to the status of their own repo?
Turns out there is a simple solution, but only for GitHub's own Actions status badges. We've changed the image URL in our README.mds to relative.
The only minor thing is GitHub will insert /blob/<branch>/ into relative links when rendering the readmes.
For example, workflows/task1/badge.svg will become https://github.com/myorg/labX/blob/master/workflows/task1/badge.svg), which won't render. So we had to prepend '../../' to fool it.
TLDR: in repo's README.md, use
![](../../workflows/<workflowname>/badge.svg)
to get a badge for an Action status in this repo. This way, each student will get a badge referring to his own repo, not the template repo.
However, still looking for a way to use an external badge service like shields.io in a way relative to the repo.
I agree it would be a great feature to have.
It looks like at this point, GitHub Template Repositories do not support variable substitution, which is what would make it possible.
I see it is discussed briefly here:
Variable substitution for GitHub Template Repository Usage
Perhaps you should join the discussion and/or cast your Kudo.

GitHub Website Publishing of "Knit"-Generated HTML files in RStudio

I want to share a step-by-step illustration on how to publish online your work on RStudio using GitHub pages.
A lot of people taking the Coursera courses on data have problems with it if they don't come from computer science, including myself, so I want to share a system that works. I'm sure it can be greatly improved.
Let's do it step-by-step, really easy:
1. Start with Github, not with RStudio.
Don't have an account, sign-up for one - it's free and incredibly valuable. Now go to Repositories (top menu bar), and press on the green button New in the upper-right-hand corner. Give a name to the repository ("test" for our puposes). You can skip the Description if you are in a hurry to proving to yourself that it works (same for the prompt to write some memo style one-liner under README). So go... click on Create Repository (green button). Now don't panic... just go directly to Settings (the cogwheel symbol in the vertical menu on the right-hand side). Perfect! One more click and we're there... Launch automatic page generator. Now we enter the guided part. Feel free to leave all this as is for now... We can modify it later, or we can go back and do it all over again when we know the end of the story (with a real repository that we do intend to publish. Click on Continue to layouts. Click on any of the designs (I chose "Architect)... And Publish page (green button upper-right corner). Beautiful!
Quick check: Click on Settings again, and check under GitHub Pages for the message: "Your site is published at http://...github.io/test. In my case the address is http://rinterested.github.io/test/ (was... I erased it after I finished this post) beacuse my Github account is RInterested. Very critical: pay attention to the structure: github.io without this there's no website. Now you can go to your browser, type the address and see that a new site has been born (caution: sometimes this takes minutes to materialize).
2. Now it's time to go to RStudio. If you're taking the Coursera course this is your comfort zone. If not I will assume that you've been working with [R], and that a simple download of RStudio (free online) is about to change your life for the better.
So we start RStudio and we go to the upper-right corner, where there is a cube containing an R, and the word Project. See it? Great, because we are going to start a New Project from the pull-down menu. Pop-up... which one to choose? Version Control is the answer. More pop-ups... No panicking... Click on the gray/red/green sideways GIT symbol ("Git Clone a project from a Git repository"). We have that, remember? We called it "Test". And we are facing a final screen with three fields to fill in. Under Repository URL we need to enter information that will require a quick trip back to Github for a second...
Are you there? OK... Do you see the HTTPS clone URL thing with a clipboard symbol on the right, half-way down within the test repository? Click on the clipboard symbol... Copied! Great! Now we go back to the screen with questions on RStudio, where we got re-routed, and do a right-click and paste, filling in the Repository URL field of the questionnaire. The rest is not critical. Press on Create Project... That's it!
3. Time to work. Let's now create a new R Markdown document by clicking on the corresponding option on the pull-down menu in the left-upper corner (green plus sign on a sheet of paper icon). Give it a name. You are the author. Select HTML. Click OK. Now you can modify, add, or just leave what popped-up on the screen as is to finish up the demonstration. Notice that there are so-called chunks of code started with ``{r} which indicate that the following code will be executed upon rendering the html document (or pdf). echo=FALSE means that only the result of the code (not the actual command) will be printed.
OK. Press on the top menu where you see a knitting pin (Knit HTML)... give it a name and save the document... Very important... whatever you name it it has to end up in .Rmd (case sensitive). What about "cars.Rmd"? Original enough... Save it and watch RStudio do its magic... Hopefully you're now admiring a beautiful webpage with a plot and numbers... Only one problem... It is NOT online.
4. Pushing our work to GitHub:
We are going now in the opposite direction. First, click on the GiT super-cool symbol on the top menu (above "knit HTML" depending on the configuration of your RStudio). It's a pull-down menu. Select Commit. You can select cars.html, or everything. Disregard a warning message, and post an ultra-short note under "Commit message". Whatever you want to write (e.g. "update"?). Click on the Commit button - very important! Now you are ready to click on Push... You guessed it... It's the green button. You will be prompted to enter your Github account Username and Password. Do so.
5. Back to GitHub:
Refresh the page displaying our "test" repository. You should now see the additional documents, including cars.html
Quick check: Go to your browser and enter in the URL bar what for me would be rinterested.github.io/test/cars.html (remember that you can get your own website address by going under Settings as explained above), and then just tag on the name of the document we have worked on with RStudio.
6. Hyperlink the pages:
As a test click on "index.html" under the "test" repository and somewhere there, in the body embed the following:
Click here to go to cars.
You will have to click on the pencil icon to edit this file. When done click on Commit changes. Go back on the browser to see your site. Refresh until it's updated with the hyperlink you just embedded. Click on it... You are now watching your RStudio work fully functional online. Magic!
Now it's just a matter to change things around using some html code quickly accessible online, changing the wording on the index.html (home page), or perhaps building a nice site with internal cohesiveness from scratch.
Good luck!
An alternative (more manual) approach - anything covered on the initial answer skipped.
1. Create a Repository in GitHub
Let's call it Course_project without need to README - we're just going to need its URL.
2. Open Windows PowerShell (or Git Bash)
Opening Git Bash is as simple as to right click on the directory in Windows Explorer we want to select, and click on Git Bash here. I'll use PowerShell. You can get the directory you're in by typing pwd. From there we can type ls to list subfolders, all along changing directory to reach where we want to be - for instance cd R to get R as the working directory.
Clone project by typing https://github.com/RInterested/Course_project.git (I am RInterested, so change that part to your GitHub username; also remember that "Course_project" is the name of this project). Change the directory to Course_project by typing cd Course_project. We now create a branch without parent branches: git checkout --orphan gh-pages. Make sure that the cloned Course_project is empty by typing: git rm -rf . We'll soon work with real RStudio markdown, but just to test what we have done so far, we can type into the empty working directory a name of a webpage: echo "Test Page" > index.html. Time now to Add/Commit/Push: git add index.html followed by git git commit -a -m "first commit", and git push origin gh-pages. This page is now visible at: http://RInterested.github.io/Course_project/index.html.
3. Creating content with RStudio
We have a directory (Course_project) and a toy index.html in it... We need real content. So we go to RStudio. Create an R Markdown file and name it (I'm calling it mtcars). Check HTML as the output. Change the document (some info about it in the answer above). Finally, an important step: Save it as Index.Rmd(make sure that the R working directory is the same as in PowerShell). Click on knit HTML to create the html file rendering the R code embedded in R Markdown.
4. Pushing it upstream with PowerShell
Now we have material within the directory Course_project, but it is not online - it is still local (you can go to it with Windows Explorer and see the html file under "index"). Type git status to see the changes made, and again follow the routine Add/Commit/Push: git add ., followed by git commit -a -m "commit", and git push origin gh-pages.
After a while the page will be live in http://RInterested.github.io/Course_project/index.html
5. Adding a second page
We can now start a second R Markdown file on RStudio (I labeled it Second_page and saved it as Second_page.Rmd. After writing what we want we knit HTML, and we can see these two new files appear in the Course_project local folder. We simply have to Add/Commit/Push like before in PowerShell. The new page will be in http://rinterested.github.io/Course_project/Second_page.html. It is very easy now to type a hyperlink on the first (index.Rmd) to the second (Second_page.html), knit the index.Rmd, and push it up to the web.

I cannot make my Morea repository private. How do I fix that?

When I try to make my Morea repository private, GitHub says that public forks cannot be made private. What do I do?
This was a bug in the original QuickStart instructions, which directed you to create a fork of the basic-template. They have now been fixed, but for those who have already set up a repo, please do the following:
(1) On your laptop, rename your morea directory (let's call it ics314f13/) to ics314f13-old/. Don't delete the directory, just rename it to something different.
(2) Go to GitHub, and delete your repository (i.e. ics314f13). You do this in the Settings page. While this appears scary, don't worry because you still have all your files in your local directory (i.e. ics314f13-old/). This step will mean that you've lost your commit history, but I assume that's not important. (If history is important, there are other more complicated ways to fix things, let me know.)
(2) Follow the revised QuickStart directions starting here:
http://morea-framework.github.io/quickstart.html#Createacourse
The new instructions direct you to create a new, empty GitHub repo. Use your original repo name, the one you just deleted (i.e. ics314f13).
You'll then download a new script (morea-vanilla-install.sh) and run it to initialize the contents of your empty repo with the contents of basic-template. The net effect is similar to a fork, but since you didn't actually fork, you'll be able to make your repo private if you want.
(3) Copy over the changed files from your "old" directory to your "new" directory.
You'll typically just copy over the file master/src/_config.yml and the entire directory master/src/morea/.
Advanced users like Cam might have created new navbar pages. He'll need to copy over these changes as well.
(4) Copy over scripts.
Copy over the morea-run-local.sh script from the "old" directory, and check to make sure everything looks OK.
Copy over the morea-publish.sh script from the "old" directory, and run it to push your changes to your new GitHub repo.
(5) Make your repo private.
You should now be able to go to the settings menu and make your repo private.

How to add specific subfolder of subrepo

I'm comming from SVN background and I'm having a problem of adding to my main repo a subfolder of subrepo. That means that I don't want to add the whole subrepo to my main project - only a part of it. In my situation I want to include only source files of my library excluding all unit tests.
I have created .hgsub file and wrote there:
libs/my_std_lib = https://myreposhost.com/my_std_lib_repo/src/main/java/
But when I'm trying to synchronize libs/my_std_lib folder I get such error: HTTP Error: 404 (Not Found)
When I try to synchronize without subpath (https://myreposhost.com/my_std_lib_repo/) - it works well.
So what do I do wrong or this is not posible in hg?
The answer is pretty simple : it's impossible to clone only a part of a repository with Mercurial.
By extension, you can't add only a part of a repository as a subrepo.
Sorry.

Mercurial's authors description

I'm trying to change Mercurial's template.
When I push some files to my repository, the log files list my PC's name, not user's name that is logged in.
I don't want the PC's name, I want logged user's name shows up.
How I do it?
#Praveen-K has the right answer and Lazy Badger and Lasse have the details you're missing. Here it is spelled out, but go pick Praveen's answer:
The user name you're seeing in/on your remote repository are completely unrelated to:
Any settings on your repository/server
The username you use to authenticate to your repository
Instead that string, called 'author' is burned into the changeset (commit) at commit time and is entirely crafted on your "PC". You could set it to anything you want and once you push that commit to the repository that's how it will display.
At your current skill level you're not going to successfully change that string in commits you've already made, but if you dive into a good explanation (not lookup commands) like the hg book you'll come away understanding things.
Make the entry in to your hgrc file. This file should be in your .hg/ directory (it may be in your repo or you can do in your home directory) and if it is not exist make the file with the name of hgrc in that folder.
[ui]
username = Your Name <your#mail>