学生の備忘録なブログ

日々のことを忘れないためのブログです。一日一成果物も目標。技術系はQiitaにあげるように変更しました。

リモートでgit commitしてからリモート(github)へpushする方法

リモートでgit commitしてからリモート(github)へpushする方法

普通は、githubでnewRepositoryを押して、git init @hogeをターミナルで実行する。

しかし、今回はローカルで

git init
git commit -m ""
git push

したことによりエラーが出た。

エラー

要はRepositoryを作れというエラー

git push                                                                                  [master]
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>

解決策

  1. githubでnew repositoryでリポジトリ作成
  2. @以下をコピー
  3. git remode add をする
git remote add origin git@github.com:alexpchin/<reponame>.git
git push -u origin master

gitのみで完結できないかと調べたけど面倒なので終わり。