emacs:emacs26.1_use_magit_on_windows_10

差分

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

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

次のリビジョン
前のリビジョン
emacs:emacs26.1_use_magit_on_windows_10 [2018-06-12 12:23]
Decomo 作成
emacs:emacs26.1_use_magit_on_windows_10 [2021-08-14 23:50] (現在)
Decomo
行 25: 行 25:
 magit-popupのみ、うちの環境では(ryだったので[[https://github.com/magit/magit-popup|公式リポジトリ]]から(ry magit-popupのみ、うちの環境では(ryだったので[[https://github.com/magit/magit-popup|公式リポジトリ]]から(ry
  
 +v2.90からtransientパッケージも必要になったっぽい?
  
-==== Magitの設定 ====+==== git実行ファイルの設定 ====
  
-最も重要なのが''magit-git-executable''変数の中身。変数名の通り、Magitはgitコマンド実行時に本変数の値用する。+Magitはgitコマンド実行時に''magit-git-executable''変数のgitコマンドを使用する。
  
-''magit-git.el''''(defcustom magit-git-executable)''を見るとわかるのだがWindows用に特殊な処理が入っており、変数''C:\Program Files\Git\bin\git.exe''といった絶対パス指定となことる。+[[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を自動で探してくれようだ、上手く設定されない場合は手動で設定する。
  
-TRAMPを使ってリモートのリポジトリを操作する場合は、<fc #ff0000>リモートgit実行ァイを指定</fc>する必要がある。 +TRAMPを使ってリモートのリポジトリを操作する場合は、''magit-remote-git-executable''が使用される。大抵、リモート環境といえばUNIX系だと思うが、そ場合はデト値の"git"のままで動くず。動かなければリモート環境gitをフルパス定してやる
- +
-今回はリモートの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.1528773835.txt.gz
  • 最終更新: 2018-06-12 12:23
  • by Decomo