githubでpushの度にパスワードを聞かれた件
githubに新しくリポジトリを作ってpushしたら、毎回コマンドラインでuserとpassを聞かれたので、それを解消した方法を書きます。
結論から言うと、以下のコマンドを実行し、リモートリポジトリoriginのURLを変えました。
$ git remote set-url origin git@github.com:xxxxx/xxxxxx.git
補足
原因は、httpを使ってしまったかららしいです。 githubのページで新しいリポジトリを作った後、表示された以下のコマンドを実行。
$ touch readme.md $ git init $ git add readme.md $ git commit readme.md -m 'first commit' $ git remote add origin https://github.com/xxxxx/xxxxx.git $ git push -u origin master Username for 'https://github.com': Password for 'https://xxxxx@github.com':
git remote add
の所でhttpsを使ってしまったから、との情報を見つけたので、これを変えるべく、冒頭のコマンドを実行。
変更前
$ git config -l ・・・ remote.origin.url=https://github.com/xxxxx/xxxxx.git
set-urlでリモートリポジトリoriginのURLを変更後
$ git config -l ・・・ remote.origin.url=git@github.com/xxxxx/xxxxx.git
この後git push
したら、最初の1回だけgihubのパスワードを聞かれましたが、その後は聞かれずにpushできるようになりました!