GitHub: Difference between revisions
Line 214: | Line 214: | ||
ref [https://stackoverflow.com/questions/49365327/get-sha256-hash-of-public-key] | ref [https://stackoverflow.com/questions/49365327/get-sha256-hash-of-public-key] | ||
== Clone Using Access Token == | |||
git clone https://x-access-token:<token>@github.com/owner/repo.git | |||
Documentation - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/ | |||
ref: [https://stackoverflow.com/questions/54873777/cloning-a-private-github-repo-authenticated-as-a-github-app] | |||
== Issues == | == Issues == |
Revision as of 23:58, 21 January 2024
Subpage Table of Contents
- GitHub/Actions
- GitHub/Actions Runner
- GitHub/Actions Runner API
- GitHub/Actions Runner Controller
- GitHub/Copilot
- GitHub/DMCA
- GitHub/Duplicating a Repository
- GitHub/GH Client
- GitHub/GitHub Flavored Markdown
- GitHub/JWT
- GitHub/Self-Hosted Runner
- GitHub/Workflow
- GitHub/Workflow/Events
- GitHub/gh
- GitHub/gh/pr
- GitHub/gpg
GitHub
GitHub · Build software better, together. - https://github.com/
- "GitHub · Build software better, together."
Global setup:
Download and install Git git config --global user.name "Your Name" git config --global user.email kiloforce@k.ttak.org Add your public key
Next steps:
mkdir test cd test git init touch README git add README git commit -m 'first commit' git remote add origin git@github.com:kiloforce/test.git git push origin master
Existing Git Repo?
cd existing_git_repo git remote add origin git@github.com:kiloforce/test.git git push origin master
Caching Password
authentication - Git push requires username and password - Stack Overflow - http://stackoverflow.com/questions/6565357/git-push-requires-username-and-password
The following command will save your password in memory for sometime. (For git 1.7.10 or newer.)
# Set git to use the credential memory cache $ git config --global credential.helper cache
# Set the cache to timeout after 1 hour (setting is in seconds) $ git config --global credential.helper 'cache --timeout=3600'
Git
See Git
GitHub Flavored Markdown
See GitHub/GitHub Flavored Markdown
GitHub Gist
Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.
GitHub Pages
"Websites for you and your projects, hosted directly from your GitHub repository."
GitHub Pages - https://pages.github.com/
Supports static HTML content
Warning: GitHub Pages sites are publicly available on the internet, even if their repositories are private. If you have sensitive data in your Page repository, you may want to remove it before publishing.
User Pages
Only one set of User/Organization pages are available per account. (Although multiple project pages are allowed)
User/Organization Site: (must live in master branch)
- On GitHub and create a new repository named username.github.io (where username is your username (or organization name) on GitHub).
- Note: If the first part of the repository doesn’t exactly match your username, it won’t work, so make sure to get it right.
- Clone repo
- git@github.com:[USERNAME]/[USERNAME].github.io
- Add index.html
- cd username.github.io ; echo "Hello World" > index.html
- Push it
- git add --all ; git commit -m "Initial commit" ; git push -u origin master
- Browse to new site: (may have to wait a few minutes for the pages to be generated by GitHub)
- http://[USERNAME].github.io/
Project Pages
Project pages work similar to User Pages, but each project can have their own set of Project Pages.
To setup Project Pages, simply create a branch called gh-pages
# Creates our branch, without any parents (it's an orphan!) git checkout --orphan gh-pages # Remove all files from the old working tree git rm -rf .
echo "My Page" > index.html git add index.html git commit -a -m "First pages commit" git push origin gh-pages
Browse to: http://<username>.github.io/<projectname>
Custom URL
Setup a custom URL [1]
--- DNS ---
Create a CNAME on your sub domain name to point to username.github.io. [2] [3]
If pointing an apex domain level, point A record to the following IP addresses: [4]
192.30.252.153 192.30.252.154
If your DNS provider supports it, you can also have your apex domain name use an Alias (ANAME) record to point to username.github.io.
If you also create a www subdomain CNAME, GitHub will also respect this too. [5]
--- GitHub CNAME file ---
CNAME file: [6]
If you're using a custom domain to redirect your GitHub Pages site, you must create and commit a CNAME file to your GitHub Pages repository that contains the custom domain.
In the "Branches" menu, switch to your repository's Pages branch:
- For User and Organization Pages sites, the Pages branch is master.
- For Project Pages sites, the Pages branch is gh-pages.
In the new file, add a single line that specifies the bare subdomain for your custom domain. For example, use blog.example.com, not https://blog.example.com. Note that there can only be one domain in the CNAME file.
Verify the change by looking under the project's settings, under "GitHub Pages".
Note, the Project Pages site inherits the domain set for its owner's User Pages site, but can be overridden with it's own Custom URL.
Automatic Page Generation
Automatic Page Generation [7] - You can use GitHub's Automatic Page Generator to quickly create a website for a project, user, or organization.
- Go to the repository's settings page.
- Click the Automatic Page Generator button.
GitHub Pages Disk Quota
"Rule of thumb: 1GB per repository, 100MB per file" [8]
Sync Forked Repo
Configure remote for fork: [9]
git remote -v git remote add upstream https://github.com/ORIGINAL_OWNER
Sync fork: [10]
git fetch upstream git checkout master git merge upstream/master
Fix Author Email
#!/bin/sh git filter-branch -f --env-filter ' OLD_EMAIL="your-old-email@example.com" CORRECT_NAME="Your Correct Name" CORRECT_EMAIL="your-correct-email@example.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
- Modify and Run script
- git push --force --tags origin 'refs/heads/*'
Changing author info - User Documentation - https://help.github.com/articles/changing-author-info/
Anonomous Email
github no reply mail:
Go to https://github.com/settings/email and copy your no reply mail ,it would look like this ID+username@users.noreply.github.com .
https://github.com/settings/email
ID+username@users.noreply.github.com
than set this email as global email to your pc :
git config user.email 'ID+username@users.noreply.github.com
After this process your problem will fix
ref: [11]
SSH Key SHA256
ssh-keygen -lf NEWpubkey.pem
ssh-keygen -lf id_rsa.pub 2048 SHA256:5Q3idtyMMW08qsE+QPFAcEHgEe7lRK89AUboCDXXXXX ken (RSA)
ref [12]
Clone Using Access Token
git clone https://x-access-token:<token>@github.com/owner/repo.git
Documentation - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/
ref: [13]
Issues
https authentication
Error:
$ git push error: The requested URL returned error: 403 Forbidden while accessing https://github.com/oeey/ksmtp/info/refs fatal: HTTP request failed
Solutions:
- Use SSH keys and git:// protocol
- Add username:password to origin url in .git/config:
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = https://[GITUSER]:[GITPASSWORD]@github.com/oeey/ksmtp