bokunonikki.net
JP / EN

git cloneしたらディレクトリが空だった

Mon Feb 26, 2018
Mon Feb 26, 2018

初心者がありがちな「先輩gitcloneしたけどディレクトリが空です」事件の対処法。

とりあえず、落ち着いて。以下のコマンドを実行しよう。

1
$ ll -a  もしくはls -a

すると

1
2
3
drwxrwxr-x 3 user user 4096  2月 16 20:58 ./
drwxrwxr-x 8 user user 4096  2月 16 20:58 ../
drwxrwxr-x 7 user user 4096  2月 16 20:58 .git/

空だと思っていたがgitがあるぞ。

development branchを作成し、checkout

1
2
$ git branch development
$ git checkout development

次は、git remoteで確認。ちゃんとありました。

1
2
3
$ git remote -v
origin	http://github (fetch)
origin	http://github (push)

存在が確認できたので、pullしましょう。

1
2
3
4
5
6
$ git pull origin development
From http://github
 * branch            development -> FETCH_HEAD
Updating 049f741..a15545
Fast-forward
 .gitignore                                         |  15 ++

できました。

おまけ

gitのremote urlを変更する。

1
2
3
4
$ git remote set-url origin http://github
$ git remote -v
origin	http://github(fetch)
origin	http://github (push)