emacs:emacs26.1_use_magit_on_windows_10

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
emacs:emacs26.1_use_magit_on_windows_10 [2019-10-27 14:26]
Decomo
emacs:emacs26.1_use_magit_on_windows_10 [2021-08-14 23:50]
Decomo
行 27: 行 27:
 v2.90からtransientパッケージも必要になったっぽい? v2.90からtransientパッケージも必要になったっぽい?
  
 +==== git実行ファイルの設定 ====
  
-==== Magitの設定 ====+Magitはgitコマンド実行時に''magit-git-executable''変数gitコマンドを使用する。
  
-最も重要なのが''magit-git-executable''変数の中身。変数名の通りMagitはgitコマンド実行時変数の値利用する。+[[https://magit.vc/manual/magit/Git-Executable.html|マニュアル]]によれば、WindowsとmacOSではMagit読み込み時にgitコマンド絶対パス設定される。[[https://github.com/magit/magit/blob/456735401b6524f822fecc3fbb49a5c9199f9d4d/lisp/magit-git.el#L135|magit-git.el]]を見ると何やらgitコマンドのパスを求める処理が確か入っている。環境変数PATHが通っているgit.exe自動で探してくれるようだが、上手く設定されない場合は手動で設定する。
  
-''magit-git.el''の''(defcustom magit-git-executable)''を見るとわかるのだが、Windows用に特殊な処理が入っており、変数値が''C:\Program Files\Git\bin\git.exe''といった絶対パス指定となることがある。 +TRAMPを使ってリモートのリポジトリを操作する場合は、''magit-remote-git-executable''が使用される。大抵、リモート環境といえばUNIX系だと思うが、そ場合はデト値の"git"のままで動くはず動かなければリモート環境gitをフルパス定してやる
- +
-TRAMPを使ってリモートのリポジトリを操作する場合は、<fc #ff0000>リモートgit実行ァイを指定</fc>する必要がある +
- +
-今回はリモートのLinuxマシンが対象だったの、init.elで以下のように指定し+
  
 <code lisp> <code lisp>
 (require 'magit) (require 'magit)
-(setq magit-git-executable "git")+(setq magit-git-executable "U:/msys64/usr/bin/git.exe"
 +;(setq magit-remote-git-executable "/path/to/remote/git")
 </code> </code>
  
-とりあえず何も指定せずgit管理下のファイルを開き、M-x magit-statusをしてみて、正しレポジトリパスを指定したにもわらず「Create repository in /path/to/gitrepo/?と聞かれたら、Magitがgitコマンド見つけられなかった可能性が高い。それからmagit-git-executableをアレコレ指定してみるのが良いだろう。+何も指定せずgit管理下のファイルを開き、M-x magit-statusが動くかどうか見るのが手っ取り早。Git管理下にもかかわらず「Create repository in /path/to/gitrepo/?や「Searching for program: No such file or directory, git」出たら、Magitがgitコマンド見つけられなかった可能性が高い。それからmagit-git-executableをアレコレ指定してみるのが良いだろう。
  
-この辺はTRAMPの設定やら、TRAMP実行パス環境やら絡んでて非常にわかりづらい。+この辺はPATHやらTRAMPの設定やら接続先の環境やら絡んでて非常にわかりづらい。
  
 ===== 参考サイト ===== ===== 参考サイト =====
  
   * [[https://emacs.stackexchange.com/questions/27461/magit-doesnt-recognise-git-repo-through-ssh-connection|tramp - Magit doesn't recognise git repo through ssh connection - Emacs Stack Exchange]]   * [[https://emacs.stackexchange.com/questions/27461/magit-doesnt-recognise-git-repo-through-ssh-connection|tramp - Magit doesn't recognise git repo through ssh connection - Emacs Stack Exchange]]
- * [[https://qiita.com/khiraiwa/items/bf9924f3a19c780c6ae9|EmacsのTRAMPとmagitでリモートのリポジトリを扱えなかった件について]]+  * [[https://qiita.com/khiraiwa/items/bf9924f3a19c780c6ae9|EmacsのTRAMPとmagitでリモートのリポジトリを扱えなかった件について]]
   * [[https://stackoverflow.com/questions/26630640/tramp-ignores-tramp-remote-path|emacs - TRAMP ignores tramp-remote-path - Stack Overflow]]   * [[https://stackoverflow.com/questions/26630640/tramp-ignores-tramp-remote-path|emacs - TRAMP ignores tramp-remote-path - Stack Overflow]]
   * [[https://emacs.stackexchange.com/questions/35055/magit-with-tramp-is-not-working-with-git-correctly|magit with tramp is not working with git correctly - Emacs Stack Exchange]]   * [[https://emacs.stackexchange.com/questions/35055/magit-with-tramp-is-not-working-with-git-correctly|magit with tramp is not working with git correctly - Emacs Stack Exchange]]
   * [[https://qiita.com/takc923/items/c7a11ff30caedc4c5ba7|EmacsのGitクライアント:Magit]]   * [[https://qiita.com/takc923/items/c7a11ff30caedc4c5ba7|EmacsのGitクライアント:Magit]]
   * [[http://yamakichi.hatenablog.com/entry/2016/06/29/133246|Emacs Magit使い方 - yamarkz's blog]]   * [[http://yamakichi.hatenablog.com/entry/2016/06/29/133246|Emacs Magit使い方 - yamarkz's blog]]
  • emacs/emacs26.1_use_magit_on_windows_10.txt
  • 最終更新: 2021-08-14 23:50
  • by Decomo