Only repository name showing on the public link created by Github in my pages section - github

I am new to coding area, and started learning coding since last few days; I have completed some projects.
But, when I want to upload and live it on GitHub platform, it is just showing the repository name when going to the created link.
I manually uploaded 1 file of CSS and HTML each, its showing problem.

If you have your projects set up as nested Git repository inside your main local repository, then you would see those subrespo root folder as links (gitlinks, a special entry in the index) indeed.
myProjects
.git/
project1
.git/
project2
.git/
...
Make sure to create one GitHub repository per project.
You can do so from your workstation, using the GitHub CLI gh, with gh repo create:
# create a remote repository from the current directory
gh repo create my-project --source=.

Related

How to transfer Github Gist to Repository?

I am new to Github. I recently have created a gist https://gist.github.com/8d11e24576c94b2c07a9a48288082588.git and want to transfer it to my repository at https://github.com/Muhammad-Ammar-Masood/Log-In-Page.git.
The simpler approach would be to clone your repository, and copy in it your gist, as a new file.
From there, add, commit and push.
Note that you can, from command-line, list your gists with gh girst list and view the content of a particular gist with gh gist view
gh gist view https://gist.github.com/8d11e24576c94b2c07a9a48288082588.git
(you need to install gh first)
You can also, since yesterday, do it online by going to your repository Muhammad-Ammar-Masood/Log-In-Page, and use GitHub Codespace by typing ..
You can add your gist in the online VSCode there.
You can, download Github Desktop on "https://desktop.github.com/", log in , create a new repository with GitHub Desktop, then choose a local directory on your PC for the newly created repository.
You can go to your Gist and choose to download as zip at the right end of the options
Screenshot of Gist Url and the download button highlighted
You can extract the zip file to your local directory assigned for the newly created repository.
On your GitHub Desktop : You can commit and push the changes of the repository to your GitHub.

Github Wiki as a subfolder of the main project

We have a project self-hosted on our Phabricator instance. I made a mirror of the project on GitHub.
The project has a subfolder called docs that contains the documentation in Markdown.
If the project was hosted on Github, I would add the wiki as a submodule of the main project -- however, the project is hosted on Phabricator and I do not want anything on the Phabricator repo to link to GitHub.
How can I tell Github to use the docs/ folder for the wiki, without any modification needed to the Phabricator repo?
This link from GitHub's documentation would indicate that GitHub wiki's are stored in a separate repository which I would think means this is not possible.

What is the right way to manage the hugo project in GitHub?

I currently have [username]/github.io pages made with simple HTML/CSS.
Now I am trying to switch to Hugo to manage the sites more efficiently.
I understand that the Hugo (the static site generator) generates public directory which I can just copy the contents to [username]/github.io repository.
However, in this way, I have to have two different repositories to keep the Hugo project itself and the website that had generated.
What would be the correct way to keep the repositories for Hugo?
I believe in Jekyll, the pushed project will generate the github.io pages in the server side of GitHub.
For the Hugo projects, should I have to have two different repositories, one for the Hugo and the other for the generated sites?
You may need two repositories, one for Hugo’s content, and a second one that will be a git submodule with the public folder’s content in it.
Check the Hugo docs Host on Github Step-by-step Instructions:
Create a <YOUR-PROJECT> (e.g. blog) repository on GitHub. This repository will contain Hugo’s content and other source files.
Create a <USERNAME>.github.io GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>
Make your website work locally (hugo server or hugo server -t ) and open your browser to http://localhost:1313.
Once you are happy with the results:
Press Ctrl+C to kill the server
rm -rf public to completely remove the public directory
git submodule add -b master git#github.com:<username>/<username>.github.io.git public. This creates a git submodule. Now when you run the hugo command to build your site to public, the created public directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.

Can Jekyll use a config file from a different repo

I'm using Jekyll and GitHub Pages to create documentation for projects that live in separate repos that are part of an organization account in GitHub. My team has decided it makes the most sense for the docs to live in each repo alongside the code, so we'll be using a gh-pages branch in each repo.
I will also be setting up a separate gh-pages repo from the organization account to serve as a landing page. I'd like to have all of my jekyll config items live in this repo. What do I need to put in the config file in each of the repos to successfully pull all of the layouts, css/scss, etc. from this central location? Is this even possible?
Here's a visual representation
In a nutshell, I'm trying to have one place where I can make changes to the website formatting files instead of 6.
On Github pages, you can use resources from another repository by using git submodules.
This works well for _layouts and _sass, but sadly not for _includes. This due to the fact that, in Jekyll 2.x, you cannot configure _includes folder path. This has been committed in the current master and will be available as soon as Jekyll 3 is out and used by github pages.
Edit: With Jekyll 3, you can now configure includes_dir: _mydir. See documentation for Jekyll configuration.
An interim solution can be to merge includes in layouts until you're able to configure _includes path. Not so clean, but, as your templates a centralized, it will be easy to refactor.
Howto
1 - create a resources repository
Adding your organization repository as a submodule will pull both resources, post and pages. Not a good way to go because posts and pages will be present in your project blogs.
The better way is to hosts your resources (_includes, _layouts, _sass, css) in a dedicated repository at github.com/userName/resources.
In your _layouts/default.html, dont forget to call you css with :
<link rel="stylesheet" href="{{ "/resources/css/main.css" | prepend: site.baseurl }}">
2 - Project blog Setup
Create a project blog without resources files and add the resources submodule.
git submodule add https://github.com/userName/resources.git
This creates a resources folder in you repository.
Edit your _config.yml and add:
layouts: /resources/_layouts
sass:
sass_dir: /resources/_sass
You can now jekyll serve, it works.
3 - Resources workflow
As your resources are in a submodule, changes in a template or sass file will not be reflected in your blog automatically.
In order to refresh your blog you will have to do this for all your blogs.
git submodule update --remote
git commit -a -m 'resources update'
git push origin gh-pages
After getting feedback from my team, I ended up doing the following:
create new repo that will be the source of the GH-Pages site
add the individual project repos as submodules of this repo
add a script that tells jekyll to pull content from specific folders in the submodules and place them in a temp dir, then use that temp dir as the build source
#remove docs-build-temp folder if it exists
rm -rf ./docs-build-temp
#make temp-content folder
mkdir ./docs-build-temp
#copy content from doc folder in submodules into temp-content folder
cp -R ./submodule1/doc ./docs-build-temp/newdir1
cp -R ./submodule2/doc ./docs-build-temp/newdir2
#tell jekyll the content source
bundle exec jekyll build -s ./docs-build-temp
The script works when run locally and in Travis CI*.
*I set up ssh authentication between my user acct in github and each of the repos in travis to get around the fact that all of them are private. Seems to be working out ok so far.

How can I push project in specific folder in my GitHub repository?

I have created a new repository in GitHub named "EpamCourses2015". Next I created folder within it named "homeworks". There is only one URI "https://github.com/username/EpamCourses2015.git", so in my EGit plugin in eclipse I added "homeworks" myself, like "https://github.com/username/EpamCourses2015.git/homeworks" but it gives me an error when I add in ref mappings:
Transport Error: Cannot get remote repository refs.
https://github.com/username/EpamCourses2015.git/homeworks:
https://github.com/username/EpamCourses2015.git/homeworks/info/refs?service=git-upload-pack
not found
Any one can tell me please, how can I push my projects into separate folder in my GitHub repository?
Github isn't designed to be used like that really, you can only clone and push your parent repository into Github and subrepositories are not properly supported.
You should clone your EpamCourses2015 repository, add your homeworks folder into that, commit it and then push that to Github
If you wish to do this inside Eclipse, clone the EpamCourses2015 repository and create your homeworks project inside that folder, Eclipse should automatically detect the parent repository and allow you to add it