git remote で相対パスが利かなかった

Posted on 2018-09-30 in zakki

    nanashi@Owner-PC:/tmp/new-site/output$ git remote -v
    lightsail       ssh://ubuntu@XX.XX.XX.XX:~/lightsail.remote.git/ (fetch)
    lightsail       ssh://ubuntu@XX.XX.XX.XX:~/lightsail.remote.git/ (push)

としていたのだけど、lightsail で push しようとしたところ、

    nanashi@Owner-PC:/tmp/new-site/output$ git push lightsail master
    ssh: Could not resolve hostname XX.XX.XX.XX:~: Name or service not known
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

~ が駄目なのかなあ、とか思いつつ絶対パスで登録しなおしてみる。

    lightsail2      ssh://ubuntu@52.194.205.161:/home/ubuntu/lightsail.remote.git/ (fetch)
    lightsail2      ssh://ubuntu@52.194.205.161:/home/ubuntu/lightsail.remote.git/ (push)

としたら push できた。

    nanashi@Owner-PC:/tmp/new-site/output$ git push lightsail2 master
    Counting objects: 28, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (27/27), done.
    Writing objects: 100% (28/28), 8.33 KiB | 0 bytes/s, done.