Thi
View README.md
localhost
pip install grip # https://github.com/joeyespo/grip
cd myrepo
grip # Running on http://localhost:6419/
Update: grip
support with limited times of usage, we can use VSCode markdown previwer instead.
Clone via git@ (ssh)
git clone --bare git@github.com:aiegoo/ar-starbucks
git config --local --bool core.bare false
important
create .git and move HEAD branches config description hooks info objects refs
to it before running the 2nd cli.
::: success Update: It’s easier if we use Github CLI! :::
👉 More references: this and this.
If using 1 single account or need to create id keys
# Windows + Linux
ssh-keygen -t rsa -b 4096 -C "eozz21@gmail.com"
# (-C for adding comment only)
# Enter a file:
# Linux: /home/{$USER}/.ssh/id_rsa
# Windows: C:\Users\{$USER}\.ssh\id_rsa
# Enter password
Tell who you are
# Tell who you are? (it's global, you may need to set it locally for each repo)
git config --global user.name "aiegoo"
git config --global user.email "eozz21@gmail.com"
In case you have multiple accounts, you have to indicate separatedly the account in each repository,
git config user.name "aiegoo"
git config user.email "eozz21@gmail.com"
ssh/config for different accounts
If 2 accounts on 2 different platforms
# ~/.ssh/config
# Default github account: eozz21@gmail.com
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
# Other github account: thi@ideta.io
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_ideta
IdentitiesOnly yes
If 2 accounts on the same platforms, eg. Github
Host *
IdentityFile ~/.ssh/id_rsa.thi
AddKeysToAgent yes
Host *
IdentityFile ~/.ssh/id_rsa.ideta
AddKeysToAgent yes
If you use zsh?
It’s important on linux, otherwise, you won’t be able to use ssh-agent in zsh environment
# ~/.zshrc
plugins=(git ssh-agent)
update_ssh(){
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa.ideta
ssh-add ~/.ssh/id_rsa.thi
}
alias ud_ssh='update_ssh'
Everytime you have problems, just ud_ssh
.
Reset ssh-agent on terminal
# Delete all cached keys (be careful)
ssh-add -D
# Be careful, it will reset and use different agent!!!!
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
# ssh-add ~/.ssh/id_rsa_ideta
# Check saved keys
ssh-add -l
# Go to https://github.com/settings/keys
# copy public key
cat ~/.ssh/id_rsa.pub
# clone some repo
git clone git@github.com:aiegoo/portfolio.com.git
Info
- Commits to a fork don’t appear in your contributions graph.
- Commits to a generated from template can appear in your contributions graph.
- Get size of a github repo:
https://api.github.com/repos/<user>/<repo>
then find property “size”. The size is in KB.
Repo template
Archived on 14/10/21
I wanna make a theme notetheme2
based on dinhanhthi.com.
- Make
dinhanhthi.com
be a template (Go to Settings) - Create a new repo based on this template.
- Create a new branch
notetheme2
ondinhanhthi.com
. Make changes on this branch. - Everything we have a “theme change” on
dinhanhthi.com/master
, merge it to branchdinhanhthi.com/notetheme2
. -
If there are files (only for files) in
dinhanhthi.com/notetheme2
you wanna keep, add below line to.gitattributes
(under branchdinhanhthi.com/notetheme2
) before performing the merge,# add line to .gitattributes echo 'file_name.txt merge=ours' >> .gitattributes # on windows, remove `''`
- If there are folders (or files) in
dinhanhthi.com/notetheme2
you don’t wanna keep (from/master
), just delete them and make a new commit. From this time, later merges will ignore them. -
If there are folders in
/notethem2
you wanna keep the current state (instead of merging from master), create a scriptreset_folders.sh
#!/bin/sh # used for branch notetheme2 only echo 'Reset some only-this-branch folders after merging.' git reset folder_1 folder_2 git checkout . git add . git commit -m "update from master"
Each time you run the merge, run
git merge master && sh reset_folders.sh
-
Update changes from
/notetheme2
to reponotetheme2
link.# add dinhanhthi.com as a remote git remote add template [URL of the template repo]
# update the changes git fetch --all
# update from template's branch git merge template/notetheme2
-
If there is an error
fatal: refusing to merge unrelated histories
, try to add--allow-unrelated-histories
. There must be conflict.# keep remotes git merge -X theirs template/notetheme2 --allow-unrelated-histories # keep local git merge -X ours template/notetheme2 --allow-unrelated-histories
Add Shields tags
👉 Main shield site here. 👉 Example of usage: my main github page.
# scikit-learn badge
http://img.shields.io/badge/-Scikit%20Learn-efa300?style=flat-square&logo=scikit-learn&logoColor=fff
# ...<NAME>-<Background-Color>?style...&logo=<LOGO>&logoColor=<LOGO-COLOR>
- Logo name can be found at simpleicon. If the name includes spaces, replace them with dashes (e.g:
?logo=visual-studio-code
) - Wanna create a custom logo?
Errors
fatal: Authentication failed for
: It’s because you enabled two-factor authentication in your Github account.
- Generate a new token: click here.
- Copy that token and use it as a new password.
ssh: connect to host github.com port 22: No route to host
fatal: Could not read from remote repository
# solution
nano ~/.ssh/config
# add following
Host github.com
Hostname ssh.github.com
Port 443
# run again to check
ssh -T git@github.com
git diff between braches or commits
### git diff
git remote show origin
git status -uno
git show-branch *master
git remote update
git diff HEAD^ HEAD --compact-summary
git show
git diff --cached
git diff HEAD..origin/edit --compact-summary
git diff edit..origin/edit --compact-summary
For other use, see below
$ git diff HEAD..origin/edit --compact-summary
_data/tags.yml | 1 +
_data/wikiMap.yml | 1 +
_wiki/blog/2021-11-01-github-readme.md | 27 ++-
_wiki/blog/2022/2022-02-25-udacity-robot.md | 2 +-
_wiki/blog/2022/2022-04-10-radiomaster-tx16s.md | 291 ++++++++++++++++++++++-
_wiki/blog/2022/2022-06-23-ar-starbucks.md (new) | 75 ++++++
gcs-docker | 2 +-
pages/tags/tag_ar.md (new) | 12 +
8 files changed, 399 insertions(+), 12 deletions(-)
$ git pull
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 992 bytes | 3.00 KiB/s, done.
From github.com:aiegoo/documentation
3493c35a..63eb7d2e edit -> origin/edit
Updating f85d4ff9..63eb7d2e
Fast-forward
_data/tags.yml | 1 +
_data/wikiMap.yml | 1 +
_wiki/blog/2021-11-01-github-readme.md | 55 ++++-
_wiki/blog/2022/2022-02-25-udacity-robot.md | 2 +-
_wiki/blog/2022/2022-04-10-radiomaster-tx16s.md | 291 +++++++++++++++++++++++-
_wiki/blog/2022/2022-06-23-ar-starbucks.md | 75 ++++++
gcs-docker | 2 +-
pages/tags/tag_ar.md | 12 +
8 files changed, 427 insertions(+), 12 deletions(-)
create mode 100644 _wiki/blog/2022/2022-06-23-ar-starbucks.md
create mode 100644 pages/tags/tag_ar.md
(base)
The following wiki, pages and posts are tagged with
Title | Type | Excerpt |
---|---|---|
working with git remotes | post | Thu, Oct 21, 21, the nugget is to push to both branches in one command |
playing detectives to restore my sanity when something terribly wrong | post | Thu, Oct 21, 21, refactor move delete and remove differ-filter rev-list to restore lost files |
Github created first time | post | Mon, Nov 01, 21, ssh token key created first time |
Clone Mirroring | post | Wednesday, how to clone a repo with all branches and push to a new location |
Git-Category.md | post | 카테고리 2단계 (끝) |
gitteam book summary | page | summary. |
dotfiles.md | post | powershell 환경설정 |
excel2gsheet.md | post | google-apps-script를 배우는 좋은 시작점 |
git-commands.md | post | git 명령어 상황별 레시피 |
Github actions a vendor contest | page | summary. |
contents deploy automation | page | Pilot test on the automation prototype. |
docker learning curve | page | summary. |
github team | page | summary. |
git config | page | summary. |
gitlab | page | summary. |
Nextcloud | page | summary. |
Automation pipeline | page | summary. |
🔭raspberry pi project | page | summary. |
wehbook deploy automation | page | summary. |