Closed12

【Git】Gitメモ

YuichiYuichi

Issue

Commit連携

Commit時のコメントにチケット番号(#1 等)を含めれば、該当Issusにリンクが生成されるため、変更を追うことも容易になります。

Projectsについて

Issuesの各チケットを横断的に管理できる

https://na7log.com/github-issue-and-projects/

デフォルトのラベルの種類

ラベル 説明
bug バグ
documentation ドキュメントに関するIssue
duplicate 重複しているIssue
enhancement 新しい機能や改善
good first issue 初心者向けのIssue
help wanted 改善方法が見いだせていないIssue
invalid 正しくないIssue
question 質問
wontfix 対応をしないIssue

https://tonari-it.com/github-issue/

イシューのテンプレート

# 概要/Overview
# 詳細/Detail
# 再現手順/Reproduction Procedure
# 現状の状態/Status
# キャプチャまたは動画(あれば貼り付け)/Capture or video (paste if available)
# 考えられる原因/Possible causes
# 修正案/Proposed amendment

https://enlyt.co.jp/blog/github_issues-wiki/

YuichiYuichi

githubアカウントを複数使い分ける

https://zenn.dev/taichifukumoto/articles/how-to-use-multiple-github-accounts

includeIfを使うとディレクトリ単位でGitの設定を変更できるのでおすすめです。
自分は下記のように設定しています。

[includeIf "gitdir:~/development/company/"]
	path = .gitconfig_company
[includeIf "gitdir:~/development/private/"]
	path = .gitconfig_private

https://qiita.com/nako_sleep_9h/items/2078f5971fdaf3bbe767

特定のディレクトリに対して .gitconfig_private を使用し、それ以外のすべての場合に .gitconfig を適用したい場合、以下のように設定を追加すると良いでしょう。

[user]
  # Default configuration
  name = Your Name
  email = your_main_email@example.com

[includeIf "gitdir:/user/to/path/workspace-main/"]
    path = ~/.gitconfig_private

https://kakakakakku.hatenablog.com/entry/2019/11/06/114926
https://akamist.com/blog/archives/5553

VSCode の GitHub アカウントを使い分ける

VSCode でも 2 つの GitHub アカウントを使い分けたい方におすすめなのが「Visual Studio Code Insiders」です。
こちらからダウンロードできます。

Documentsを正しく頭文字大文字じゃ無いとvscode認識しない

[user]
	name = ~~~~~
	email = ~~~~~

[includeIf "gitdir:~/Documents/dev/git-private/"]
    path = ~/.gitconfig_private
YuichiYuichi

https://zenn.dev/ejointjp/articles/8a5e81b6eded88

cd ~/.ssh
ssh-keygen -t rsa -C main@example.com -f github_private
~/.ssh/config
# 個人アカウント用
Host private.github.com
  HostName github.com
  User git
  TCPKeepAlive yes
  IdentitiesOnly yes
  IdentityFile /Users/~/.ssh/github_private

↓のGitHubのプロフィールページのSSH and GPG keys → `New SSH key' ボタンをクリック。
https://github.com/settings/profile

pbcopy < ~/.ssh/github_private.pub

貼り付けたら Add SSH Key ボタンををクリックして完了

SSH接続テスト

ssh -T private.github.com

でOK

Hi [サブのユーザー名]! You've successfully authenticated, but GitHub does not provide shell access.

「Visual Studio Code Insiders」で
https://stackoverflow.com/questions/62152827/how-do-i-clone-a-private-git-repo-with-ssh-in-vscode

git@private.github.com/repository.gitを貼り付けてクローン

https://github.com/microsoft/vscode/issues/145850

このスクラップは2024/08/06にクローズされました