warning: You appear to have cloned an empty repository.

· ☕ 1
🏷️
  • #github
  • #git
  • 偉そうに色々作ってますが、実は結構なよわよわエンジニアなので、普通の人が分かるようなこと、知らなかったりします…。

    今日もgithubで新しいリポジトリ作ったらこんなの出で、困ったって話。

    $ git clone https://github.com/runau/mail.git
    Cloning into 'mail'...
    warning: You appear to have cloned an empty repository.
    

    おかしいな…。

    いつもとおんなじ感じでgithub上で新しいリポジトリ作って、クローンしただけのはずなのに…

    githubで該当リポジトリを開くと、こんなのが出てる。

    github

    cd mail
    echo "# mail" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/runau/mail.git
    git push -u origin master
    

    よく分かんないけど、ディレクトリ移動して、書いてあるのをそのまま実行。

    $ cd mail
    $ echo "# mail" >> README.md
    $ git init
    Reinitialized existing Git repository in /mnt/c/github/runau/mail/.git/
    $ git add README.md
    $ git commit -m "first commit"
    [master (root-commit) 96d62b3] first commit
     1 file changed, 1 insertion(+)
     create mode 100644 README.md
    $ git remote add origin https://github.com/runau/mail.git
    fatal: remote origin already exists.
    $ git push -u origin master
    Username for 'https://github.com': runau
    Password for 'https://runau@github.com': 
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 216 bytes | 18.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To https://github.com/runau/mail.git
     * [new branch]      master -> master
    Branch 'master' set up to track remote branch 'master' from 'origin'.
    

    うーん、できたのかな…?

    もう一回、githubを見てみる

    github

    できたみたいw

    なんか、初期化不要みたいな設定で作っちゃったのかなぁ…


    るな
    るな
    エンジニア