Skip to content

Instantly share code, notes, and snippets.

@stakiran
Created September 4, 2017 12:04
Show Gist options
  • Save stakiran/ab47411c1767e4e26b561925dbc2ddb3 to your computer and use it in GitHub Desktop.
Save stakiran/ab47411c1767e4e26b561925dbc2ddb3 to your computer and use it in GitHub Desktop.
170904_205851 Gist に(うざい GitHub Login ダイアログ無しで)wincred で push する

問題

  • Win10 Home で git version 2.14.1.windows.1 を使っている
  • %userprofile%.gitconfig の credential は helper=wincred を使っている
  • Gist を https で clone したのに、push 時になぜか以下の GitHub Login ダイアログが出てうざい
    • キャンセルしたら wincred を使う挙動になる

github_login

解決方法

C:\Program Files\Git\mingw64\etc\gitconfig の以下をいじる。

...
[credential]
	helper = manager

...
[credential]
	helper = wincred

以下、試行の後

当方 Win10 Home、clone した後の .git\config はこうなってる。

[remote "origin"]
	url = https://gist.github.com/stakiran/8d01f34304c54851b7f136d181d04af1

ここで git push origin master するとなぜか GitHub Login とかいう認証画面が出る。Esc で閉じてやると、

[master da949dc] ここにコミットメッセージ
 1 file changed, 10 insertions(+), 1 deletion(-)
uploading...
Logon failed, use ctrl+c to cancel basic credential prompt.
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 556 bytes | 556.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://gist.github.com/stakiran/8d01f34304c54851b7f136d181d04af1
   561279d..da949dc  master -> master

つまりデフォの認証(今は以下のように wincred になってる)が使われるってことか。

[credential]
	helper = wincred

毎回認証画面出るのうざいので殺せないかな?

画面はこんなん。

github_login

コマンドラインは C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager.exe これ。この辺、探ってみるか。

お、これは?

  • C:\Program Files\Git\mingw64\etc\gitconfig
[http]
	sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
	sslBackend = openssl
[diff "astextplain"]
	textconv = astextplain
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	required = true
	process = git-lfs filter-process
[credential]
	helper = manager

helper が manager になってる。これを wincred に変えたら? → 🆗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment