[{"content":" This article focuses on managing multiple Git accounts with SSH.\nThere are plenty of guides on handling multiple Git accounts, but many are fragmented or only solve part of the problem. Here&rsquo;s a streamlined summary for practical use.\nCommon scenarios include:\nUsing different SSH keys for different domains Using different SSH keys for the same domain Using different Git accounts for the same domain Ultimately, there are two main challenges:\nSwitching SSH keys with the SSH client Switching Git accounts with the Git client In most cases (about 90%), simply using different SSH keys is enough. The Git account identity (username &lt;username@domain&gt;) is usually less critical.\nSSH Account Configuration For SSH basics, see GitHub&rsquo;s official docs.\nThe most common approach is to use the Host directive in your ~\/.ssh\/config to specify different keys:\nHost github.dev HostName github.com IdentityFile ~\/.ssh\/github_rsa IdentitiesOnly yes Host gitlab.yourdomain.com IdentityFile ~\/.ssh\/gitlab_rsa IdentitiesOnly yes This lets you use different SSH keys for different repos, even with the same Git account.\nGit Account Configuration Why do this?\nCompanies often use private Git servers with domain accounts You may want to separate personal and work accounts on GitHub You can have Git use different accounts per workspace using git config includes:\n[includeIf &#34;gitdir:~\/workspace_github\/&#34;] path = ~\/.gitconfig-github [includeIf &#34;gitdir:~\/workspace_gitlab\/&#34;] path = ~\/.gitconfig-gitlab [includeIf &#34;gitdir:~\/workspace_work\/&#34;] path = ~\/.gitconfig-work [filter &#34;lfs&#34;] required = true clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process [init] defaultBranch = main [core] symlinks = true ignorecase = false [pull] rebase = true Each ~\/.gitconfig-xxx just sets your name, email, and optionally a signing key:\n[user] name = github_username email = github_username@github.com signingkey = &lt;YOUR_GPG_KEY_ID&gt; [init] defaultBranch = main [commit] gpgsign = true With this, you&rsquo;ll use the right Git identity in each workspace.\nCombine this with your SSH config. Test with ssh -T git@github.dev.\nFor example, to use two GitHub accounts with different SSH keys, just replace github.com with your custom host (e.g., github.dev) when cloning:\ngit clone git@github.dev:user\/repo.git\nBonus: Custom git Wrapper To automate domain switching, here&rsquo;s a simple wrapper script. It checks your current directory and rewrites the clone URL if needed:\n#!\/bin\/bash REAL_GIT=&#34;\/usr\/local\/bin\/git&#34; if [[ &#34;$1&#34; == &#34;clone&#34; ]]; then current_dir=$(pwd) if [[ &#34;$current_dir&#34; == \/Users\/&lt;your_username&gt;\/workspace_github* ]]; then shift for arg in &#34;$@&#34;; do if [[ &#34;$arg&#34; =~ ^git@github\\.com: ]]; then new_url=&#34;${arg\/git@github.com:\/git@github.dev:}&#34; echo &#34;[git wrapper] Replacing clone URL with: $new_url&#34; exec &#34;$REAL_GIT&#34; clone &#34;$new_url&#34; fi done fi fi exec &#34;$REAL_GIT&#34; &#34;$@&#34; ","permalink":"https:\/\/genffy.com\/en\/posts\/202504\/git-multi-account-manage\/","summary":"<blockquote>\n<p>This article focuses on managing multiple Git accounts with SSH.<\/p><\/blockquote>\n<p>There are plenty of guides on handling multiple Git accounts, but many are fragmented or only solve part of the problem. Here&rsquo;s a streamlined summary for practical use.<\/p>\n<p>Common scenarios include:<\/p>\n<ul>\n<li>Using different SSH keys for different domains<\/li>\n<li>Using different SSH keys for the same domain<\/li>\n<li>Using different Git accounts for the same domain<\/li>\n<\/ul>\n<p>Ultimately, there are two main challenges:<\/p>","title":"Git Multi Account Manage"},{"content":" Why note this? PR&rsquo;s CI checked failed as i skipped install dependency and update pnpm-lock file, so i must to install it and update pnpm-lock file to pass CI. PR&rsquo;s details: https:\/\/github.com\/originjs\/vite-plugin-federation\/pull\/127\nWhen install pnpm install playwright-chromium always pending like this:\nnode_modules\/.pnpm\/playwright-chromium@1.16.3\/node_modules\/playwright-chromium: Running install script... The solution is try to manual install chromium and ffmpeg, the deitails: details\uff1ahttps:\/\/github.com\/microsoft\/playwright\/blob\/main\/packages\/playwright-chromium\/install.js The version&rsquo;s info and install details pls check this file: https:\/\/github.com\/microsoft\/playwright\/blob\/main\/packages\/playwright-core\/src\/utils\/registry.ts\nManual Install chromium download it directly\nffmpeg brew install ffmpeg\nFYI: If you encounter such an error\ntar: Error opening archive: Failed to open &#39;\/path\/to\/xxxx.tar.gz&#39; # tar --extract --no-same-owner --file \/path\/to\/xxxx.tar.gz --directory \/private\/tmp\/yyyyy can try export HOMEBREW_BOTTLE_DOMAIN='' and rerun\nLast Rerun pnpm install playwright-chromium will be smoothly and worked.\nReference https:\/\/zhuanlan.zhihu.com\/p\/383707713 ","permalink":"https:\/\/genffy.com\/en\/posts\/mac-failed-to-install-playwright-chromium\/","summary":"<blockquote>\n<p>Why note this? PR&rsquo;s CI checked failed as i skipped install dependency and update pnpm-lock file, so i must to install it and update pnpm-lock file to pass CI.\nPR&rsquo;s details: <a href=\"https:\/\/github.com\/originjs\/vite-plugin-federation\/pull\/127\">https:\/\/github.com\/originjs\/vite-plugin-federation\/pull\/127<\/a><\/p><\/blockquote>\n<p>When install <code>pnpm install playwright-chromium<\/code> always pending like this:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">node_modules\/.pnpm\/playwright-chromium@1.16.3\/node_modules\/playwright-chromium: Running install script...\n<\/span><\/span><\/code><\/pre><\/div><p>The solution is try to manual install <code>chromium<\/code> and <code>ffmpeg<\/code>, the deitails: details\uff1ahttps:\/\/github.com\/microsoft\/playwright\/blob\/main\/packages\/playwright-chromium\/install.js\nThe version&rsquo;s info and install details pls check this file: <a href=\"https:\/\/github.com\/microsoft\/playwright\/blob\/main\/packages\/playwright-core\/src\/utils\/registry.ts\">https:\/\/github.com\/microsoft\/playwright\/blob\/main\/packages\/playwright-core\/src\/utils\/registry.ts<\/a><\/p>\n<h1 id=\"manual-install\">Manual Install<\/h1>\n<h2 id=\"chromium\">chromium<\/h2>\n<p><a href=\"https:\/\/download-chromium.appspot.com\/\">download it<\/a> directly<\/p>","title":"Mac Failed to Install Playwright Chromium"},{"content":"docker basic usage # remove old version docker image ls docker image rm &lt;image_id&gt; #stop &amp; remove old container docker container ls -a docker stop &lt;container_id&gt; docker container prune # rerun docker run -d -p 1337:1337 &lt;image_id&gt; docker logs &lt;container_id&gt; login docker login &lt;REPOSITORY_URL&gt; --username=zhengfei.li # type password build &amp; push docker build --build-arg &lt;ARG_KEY&gt;=&lt;AGR_VALUE&gt; -t &lt;TAG_NAME&gt; -f .\/&lt;DOCKERFILE_NAME&gt; . # tag name with repo url docker tag &lt;image_id&gt; ${{ REPOSITORY_URL }}\/${{ REPOSITORY_NAMESPACE }}\/${{ github.event.repository.name }}:latest # push docker push ${{ REPOSITORY_URL }}\/${{ REPOSITORY_NAMESPACE }}\/${{ github.event.repository.name }} # pull docker pull ${{ REPOSITORY_URL }}\/${{ REPOSITORY_NAMESPACE }}\/${{ github.event.repository.name }}:latest build new image base biz image config files Dockerfile.node\nFROM &lt;BASE_IMAGE&gt; ARG NODE_VERSION_DEFINE=12.20.0 LABEL io.k8s.display-name=&#34;biz_base_node&#34; \\ name=&#34;biz_node\/node:${NODE_VERSION_DEFINE}&#34; \\ version=&#34;${NODE_VERSION_DEFINE}&#34; \\ maintainer=&#34;owner &lt;zhengfei.li@orgname.com&gt;&#34; ENV NODE_VERSION ${NODE_VERSION_DEFINE} ENV ARCH x64 WORKDIR \/opt\/biz-cloud # RUN curl -O &#34;https:\/\/nodejs.org\/download\/release\/v${NODE_VERSION}\/node-v${NODE_VERSION}-linux-${ARCH}.tar.gz&#34; \\ # RUN wget &#34;https:\/\/nodejs.org\/download\/release\/v${NODE_VERSION}\/node-v${NODE_VERSION}-linux-${ARCH}.tar.gz&#34; \\ # use local file COPY node-v$NODE_VERSION-linux-$ARCH.tar.gz \/opt\/biz-cloud\/ RUN tar -zxvf &#34;node-v$NODE_VERSION-linux-$ARCH.tar.gz&#34; -C \/opt\\ &amp;&amp; cp &#34;\/opt\/node-v$NODE_VERSION-linux-${ARCH}\/bin\/node&#34; \/usr\/local\/bin\/ \\ &amp;&amp; ln -s &#34;\/opt\/node-v$NODE_VERSION-linux-${ARCH}\/bin\/npm&#34; \/usr\/local\/bin\/npm \\ &amp;&amp; rm -f &#34;node-v$NODE_VERSION-linux-$ARCH.tar.gz&#34; \\ &amp;&amp; node --version \\ &amp;&amp; npm --version \\ &amp;&amp; npm config set registry https:\/\/registry.npmmirror.com \\ &amp;&amp; npm install pm2 -g COPY npmrc \/root\/npmrc RUN mv \/root\/npmrc \/root\/.npmrc npmrc\n# .npmrc file content registry=https:\/\/registry.npmmirror.com\/ user=0 unsafe-perm=true TARGET=null # add as needed usage docker build --build-arg NODE_VERSION_DEFINE=&lt;NODE_VERSION&gt; -f .\/Dockerfile.node . docker-compose # replace &lt;version_id&gt; with you want to build, can pick one on https:\/\/github.com\/docker\/compose\/releases sudo curl -L &#34;https:\/\/github.com\/docker\/compose\/releases\/download\/&lt;version_id&gt;\/docker-compose-$(uname -s)-$(uname -m)&#34; -o \/usr\/bin\/docker-compose sudo chmod +x \/usr\/bin\/docker-compose docker-compose --version ","permalink":"https:\/\/genffy.com\/en\/snippet\/","summary":"<h2 id=\"docker\">docker<\/h2>\n<h3 id=\"basic-usage\">basic usage<\/h3>\n<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-shell\" data-lang=\"shell\"><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># remove old version<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker image ls\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker image rm &lt;image_id&gt;\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\">#stop &amp; remove old container<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker container ls -a\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker stop &lt;container_id&gt;\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker container prune\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># rerun<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker run -d -p 1337:1337 &lt;image_id&gt;\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker logs &lt;container_id&gt;\n<\/span><\/span><\/code><\/pre><\/div><h3 id=\"login\">login<\/h3>\n<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-shell\" data-lang=\"shell\"><span class=\"line\"><span class=\"cl\">docker login &lt;REPOSITORY_URL&gt; --username<span class=\"o\">=<\/span>zhengfei.li\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># type password<\/span>\n<\/span><\/span><\/code><\/pre><\/div><h3 id=\"build--push\">build &amp; push<\/h3>\n<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-shell\" data-lang=\"shell\"><span class=\"line\"><span class=\"cl\">docker build --build-arg &lt;ARG_KEY&gt;<span class=\"o\">=<\/span>&lt;AGR_VALUE&gt; -t &lt;TAG_NAME&gt; -f .\/&lt;DOCKERFILE_NAME&gt; .\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># tag name with repo url<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker tag &lt;image_id&gt; <span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_URL <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_NAMESPACE <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ github.event.repository.name <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>:latest\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># push <\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker push <span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_URL <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_NAMESPACE <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ github.event.repository.name <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\"><span class=\"c1\"># pull<\/span>\n<\/span><\/span><span class=\"line\"><span class=\"cl\">docker pull <span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_URL <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ REPOSITORY_NAMESPACE <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>\/<span class=\"si\">${<\/span><span class=\"p\">{ github.event.repository.name <\/span><span class=\"si\">}<\/span><span class=\"o\">}<\/span>:latest\n<\/span><\/span><\/code><\/pre><\/div><h3 id=\"build-new-image-base-biz-image\">build new image base biz image<\/h3>\n<h4 id=\"config-files\">config files<\/h4>\n<p><code>Dockerfile.node<\/code><\/p>","title":"Snippets"},{"content":"Hi there \ud83d\udc4b The internet ID is genffy, the real name is Li Zhengfei. Current job is Front-end Developer, and hope to become an engineer. Like running, occasionally swimming, cycling\nMBTI INTJ\n","permalink":"https:\/\/genffy.com\/en\/about\/","summary":"<p>Hi there \ud83d\udc4b  <br>\nThe internet ID is <code>genffy<\/code>, the real name is <code>Li Zhengfei<\/code>.    <br>\nCurrent job is Front-end Developer, and hope to become an engineer. <br>\nLike running, occasionally swimming, cycling<\/p>\n<h2 id=\"mbti\">MBTI<\/h2>\n<p><a href=\"https:\/\/www.16personalities.com\/intj-personality\" target=\"_blank\">INTJ<\/a><\/p>","title":"About"}]