windowsのgit 1.8.5.2.で fatal: could not read Password for 'https://XXXXX':No such file or directoryのエラーになる

bitbucketにpushできなくなった。。。
httpsだとだめなようだ。

現象

httpsでユーザー名指定してgit pushだと以下のエラーになる

fatal: could not read Password  for 'https://orangeclover@bitbucket.org':No such file or directory

httpsでユーザー名なしで、git pushだと以下のエラーになる

fatal: could not read Username for 'https://bitbucket.org': No such file or directory

git clone、git fetchも同じ現象になる。

条件

  • バージョンアップ前は正常にpushできた環境
  • gitを1.8.1.2から1.8.5.2にあげたら動作しなくなった

環境

  • git:version 1.8.5.2-preview20131230/git version 1.8.5.2.msysgit.0
  • Windows 7 x64



対処

修正されてるようだが、1.8.5.3のWindows版はまだでてないので、
それまでの対処。

nyaosで日本語ディレクトリ名、ファイル名が文字化けする→解決


nyaosで日本語ディレクトリ名、ファイル名が文字化けする
去年の12月ごろ気づいて放置していた。
それまでは、普通に使えてたんだけどな。
何かを変更した記憶はない。
_nyaをいじった記録もない。

なにかの環境が変わったのだろう。残念ながら、それが分からない。
上記は、普段使用ていたckw + nyaosの環境のスクリーンショト。


切り分けのため、nyaos単体とコマンドプロンプト+nyaosで実行

正常

文字化け
コマンドプロンプトのフォントは、MSゴシック
コマンドプロンプトを経由すると文字化けするようだ。
ckwも右クリックから起動するときは、コマンドプロンプト経由になってるからか。


環境

  • Windows 7 x64
  • Nihongo Yet Another Open Shell 3.3.4_0 (c) 2001-12 by HAYAMA,Kaoru

回避方法

レジストリに以下のVBScriptを登録して、起動すると文字化けしない。

set objSHell = WScript.CreateObject("WScript.Shell")
objSHell.Run "C:\usr\bin\ckw.exe -cd " & WScript.Arguments(0) & " -g 160x36+0+0 -tr 230 -e C:\usr\bin\nyaos.exe", 1


おかしな点、アドバイス、調査するために必要な資料等々、なにかあれば
コメント、トラックバックはてブTwitter @orange_clover宛 で、お願いします。
なお、Windowsを使わなければいいというコメントは、間に合ってます。


チケットが発行された。
https://bitbucket.org/zetamatta/nyaos3000/issue/18/


修正が作成された

そう言ってもらえるとありがたい。

gitconfigに設定するWindowsのいろいろなエディタのオプション

WindowsでGitを使ってて、人に聞かれて困ることの1つにコミットメッセージで
使用するエディタの設定がある。
使用しているエディタがバラバラ、かつ、utf-8の指定の仕方もエディタそれぞれなので
使ってる本人がヘルプ等で調べなきゃならなくなる。
コマンドオプション、起動オプション等に項目に載ってると思うのだが
結構手間取ったりする。


とりあえず、周りの人が使ってるエディタで分かったものをまとめ

間違いがあったら、修正してください。

注意事項

'C:/Program Files (x86)/Hidemaru/Hidemaru.exe' //fu8

秀丸コマンドラインに設定するUTF-8のオプションは「/fu8」だ。
gitconfigに設定する場合は、オプションであることを示す/を足す必要があるので
「//fu8」になる。

環境、OSごとに.gitconfigの設定を切り替えたい

やりたいこと

  • 職場と個人のPCで、ユーザー名とメールアドレスは違うものを使用したい
  • coreのエディター、diffツール、mergeツールは、OSごとに異なるものを使用したい
  • alias、color、などの設定は全ての環境で同じにしたい

方法

Git 1.7.10 から、gitconfigでincludeディレクティブが使用できるようになった。
これを使用することにより、別のファイルの読み込みができるようになる。

  • .giconfigの設定
[include]
	path = .gitconfig.user
	path = .gitconfig.os

.gitconfig.userと.gitconfig.osを環境に合わせたシンボリックリンクを張る。

会社
Windows x86 Windows x64 Solaris Linux Windows Linux
.gitconfig.user
.gitconfig.orangeclover
.gitconfig.REALNAME
.gitconfig.os
.gitconfig.windows.x86
.gitconfig.windows.x64
.gitconfig.solaris
.gitconfig.linux

○:リンクを張るもの


シンボリックリンク

実際には、.gitconfig.*は以下のディレクトリに置いてある
~/dotfiles/
%userprofile\dotfiles

LinuxSolaris
  • 設定方法
  ln -s 実際のファイル リンク
    $ cd ~
    $ ln -s dotfiles/.gitconfig.linux .gitconfig.os
    $ ln -s dotfiles/.gitconfig.orangeclover .gitconfig.user
Windows

XP、Vista、7、8、2003、2008、2012で使用するコマンドが違う。
lnとオプションの順番も違ったりするので困る。

    mklink リンク 実際のファイル
  cd %userproile%
  C:\Users\orangeclover>mklink .gitconfig.user dotfiles\.gitconfig.orangeclover
  .gitconfig.user <<===>> dotfiles\.gitconfig.orangeclover のシンボリック リンクが
  作成されました


  C:\Users\orangeclover>mklink .gitconfig.os dotfiles\.gitconfig.windows.x64
  .gitconfig.os <<===>> dotfiles\.gitconfig.windowsx64 のシンボリック リンクが作
  成されました

gitconfig

共通(.gitconfig)
[include]
	path = .gitconfig.user
	path = .gitconfig.os
[color]
	ui = auto
[color "diff"]
	meta = white bold
	frag = cyan
	old = red
	new = green
	whitespace = red reverse
[alias]
	st = status
	sts = status --short
	co = checkout
	br = branch
	ci = commit

[mergetool]
	keepBackup = false
Windows.x64
[core]
	quotepath = false
	editor = 'C:/Program Files (x86)/Hidemaru/Hidemaru.exe' //fu8

[merge]
	tool = WinMerge
[mergetool "WinMerge"]
	path = C:/Program Files/WinMerge/WinMergeU.exe
	cmd = \"C:/Program Files/WinMerge/WinMergeU.exe\" \"$MERGED\"
[diff]
	tool = WinMerge
	guitool = WinMerge
[difftool "WinMerge"]
	path = C:/Program Files/WinMerge/WinMergeU.exe
	cmd = \"C:/Program Files/WinMerge/WinMergeU.exe\" -e -ub -dl \"Theirs Files\" -dr \"Mine  Files\" \"$REMOTE\" \"$LOCAL\"
[credential]
	helper = cache --timeout=3600
Windows.x86
[core]
	quotepath = false
	editor = 'C:/Program Files/Hidemaru/Hidemaru.exe' //fu8

[merge]
	tool = WinMerge
[mergetool "WinMerge"]
	path = C:/Program Files/WinMerge/WinMergeU.exe
	cmd = \"C:/Program Files/WinMerge/WinMergeU.exe\" \"$MERGED\"
[diff]
	tool = WinMerge
	guitool = WinMerge
[difftool "WinMerge"]
	path = C:/Program Files/WinMerge/WinMergeU.exe
	cmd = \"C:/Program Files/WinMerge/WinMergeU.exe\" -e -ub -dl \"Theirs Files\" -dr \"Mine  Files\" \"$REMOTE\" \"$LOCAL\"

[credential]
	helper = cache --timeout=3600
Linux
[core]
	editor = emacsclient -nw
Solaris
[core]
	pager = nkf -e | LESSCHARSET=utf-8 less
	editor = emacsclient -nw

WindowsのGitでhelpを実行してもHTMLヘルプがブラウザで表示されない

WindowsのGit(MsysGit 1.7.11)で、git help を実行してもHTMLヘルプがブラウザで
表示されない場合がある。

現象

$ git help config

何も表示されない。
WindowsのMsysGitの場合、manコマンドがないので
man形式のヘルプは見ることができない。

条件

1.7.11のインストーラは、Git-1.7.11-preview20120620.exe、
Git-1.7.11-preview20120710.exeと2つある。
おそらく、Git-1.7.11-preview20120620.exeの方だと
ブラウザが起動しない。

Git-1.7.11-preview20120620.exeのversionは以下と表示される。
$ git --version
git version 1.7.11.msysgit.0


対処

HTMLを表示するには、-w または、--webというオプションがあるので
それを指定すればいい。

  $ git help config -w
  Launching default browser to display HTML ...

まだ、Windows版はリリースされてないけど、
1.7.12のリリースノートを見ると、気になる文章があった。
Git v1.7.12 Release Notes

* "git help" used to always default to "man" format even on platforms
where "man" viewer is not widely available.

疑問

Windowsでman形式で読む方法ってなんかあるんだっけ?





岡本 隆史、武田 健太郎、相良 幸範
価格: ¥ 2,604


価格は記載時点のものです。購入前にAmazonでご確認ください。

Git Bashでディレクトリが見にくいので、カラー設定を変更する


msysGitのGit Bashでのデフォルトのカラー設定だと、ディレクトリが青で
僕にとっては読みにくい。
なので、環境変数LS_COLORSで変更する。

LS_COLORSの設定

git diffのカラー設定を変更するのようなGit自体の設定とは別に、シェル(Git Bash) での設定もある。
環境変数LS_COLORSの設定でlsを実行した結果のディレクトリや拡張子ごとに
色づけすることができる。

LinuxUnixではお馴染みなものだが、Windowsだけを使ってる人は、どこで設定するか
分かりにくいのではないだろうか。


強いこだわりはないのだが、黒背景で青は読みにくい。

  • 設定するファイル
%userprofile%\.bashrc
  • 設定する内容
export LS_COLORS=di=01;35

カラーの値はこちらを参考に
http://www.itmedia.co.jp/help/tips/linux/l0372.html
http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors

とりあえず、ディレクトリの設定だけを変えてみた。

変更後

疑問

Git Bashの環境ではdircolorsコマンドがないので、デフォルトの設定値は
どうやって確認するんだろうか?
Gitインストール先\etc\termcap
これなのか??

git diffのカラー設定を変更する


Gitを使用する際に、status、diff、branchの情報を
以下の設定をすることにより、ターミナルのデフォルトカラーで表示することができる。

$ git config --global color.ui true 


ただ、これだと僕が使用している、WindowsSolarisLinux環境では
環境ごとにターミナルのデフォルトカラーが異なった。
WindowsのGit Bashはckwで、SolarisLinuxTeraTermという違いは
あるにせよ、TeraTermの設定は同じにしてあるのでLinuxSolarisは同じになると思ったんだが


色の情報の方が印象が強い。
diffで表示される記号よりも、色の印象の方が強いだろう。

プラットフォームごとに色が違うのは、勘違いしそうだ。
なので、統一したカラー設定に変更したい。

Solarisの青は実際のターミナル上だと僕には読めないし、
Ubuntuの黄色は目にやさしくない。
なので、Windowsの設定をベースにして変更した。

設定内容

.gitconfigに以下を設定

[color "diff"]
	meta = white bold
	frag = cyan
	old = red
	new = green

変更後

参考

  • color.diff.

Use customized color for diff colorization. specifies which part of the patch to use the specified color, and is one of plain (context text), meta (metainformation), frag (hunk header), func (function in hunk header), old (removed lines), new (added lines), commit (commit headers), or whitespace (highlighting whitespace errors). The values of these variables may be specified as in color.branch..

  • color.branch.
        • >8 ばっさり 8<----

The value for these configuration variables is a list of colors (at most two) and attributes (at most one), separated by spaces. The colors accepted are normal, black, red, green, yellow, blue, magenta, cyan and white; the attributes are bold, dim, ul, blink and reverse. The first color given is the foreground; the second is the background. The position of the attribute, if any, doesn’t matter.<<







岡本 隆史、武田 健太郎、相良 幸範
価格: ¥ 2,604


価格は記載時点のものです。購入前にAmazonでご確認ください。





濱野 純(Junio C Hamano)
価格: ¥ 2,310


価格は記載時点のものです。購入前にAmazonでご確認ください。