Clone contents of a GitHub repository (without the folder itself)

前端 未结 6 1248
梦谈多话
梦谈多话 2020-12-04 04:57

I\'d like to git clone the contents of a repository I have on GitHub. When I git clone (git@github:me/name.git...) I get a folder called name

6条回答
  •  [愿得一人]
    2020-12-04 05:27

    Unfortunately, this doesn't work if there are other, non-related directories already in the same dir. Looking for a solution. The error message is: "fatal: destination path '.' already exists...".

    The solution in this case is:

    git init
    git remote add origin git@github.com:me/name.git
    git pull origin master
    

    This recipe works even if there are other directories in the one you want to checkout in.

提交回复
热议问题