Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
OrganizationEventAdvent CalendarQiitadon (β)
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

More than 5 years have passed since last update.




  • OS:Windows 7 Professional 64bit
  • Git:1.8.3.msysgit.0


  1. GitHubにアカウントを登録
  2. ローカルでssh-keygenを実行して鍵を作成(パスフレーズも設定)
  3. GitHubのページで公開鍵(~/.ssh/id_rsa.pub)の内容を貼り付けてSSH Keyを登録
  4. リポジトリの作成
  5. 作成したリポジトリをclone
  6. コードの作成
  7. コミット(git commit)
  8. push(git push)
  9. ブラウザでpushしたファイルが参照できるかを確認



$ ssh -T git@github.com
The authenticity of host 'github.com (' can't be established.
RSA key fingerprint is <フィンガープリント>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.
Permission denied (publickey).

$ ssh-add /C/Users/<ユーザ名>/.ssh/id_rsa
Could not open a connection to your authentication agent.


さらにググったところ、事前にeval `ssh-agent`を実行しないといけない模様。

$ eval `ssh-agent`
Agent pid 1940

$ ssh-add /C/Users/<ユーザ名>/.ssh/id_rsa
Enter passphrase for /C/Users/<ユーザ名>/.ssh/id_rsa:<パスフレーズ>
Identity added: /C/Users/<ユーザ名>/.ssh/id_rsa (/C/Users/<ユーザ名>/.ssh/id_rsa)

$ ssh -T git@github.com
Hi <ユーザ名>! You've successfully authenticated, but GitHub does not provide shell access.


ssh-agentは認証エージェントと呼ばれるもので、パスフレーズを保持するプロセス。ssh-agentを実行すると実行したいコマンドが出力されるので、eval `ssh-agent`としてあげる必要がある。

git push時に警告発生


$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://github.com':

git configでpush.defaultに値を設定する必要がある。設定する値や詳細についてはここに記載されている。

$ git config --global push.default matching

$ git push
Username for 'https://github.com': <ユーザ名>
Password for 'https://<ユーザ名>@github.com':<パスフレーズ>
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 361 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/<ユーザ名>/Hello-World.git
   8d7b8fc..77fcef3  master -> master
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Help us understand the problem. What is going on with this article?