1

I want to push my github.com/username/reponame to my live webserver domain.com/demo/. I've managed to correctly push the code to that location, but it's including the top-level directory of my repo, putting the files into domain.com/demo/reponame/.

I'm very new to Git and SSH, and I'm not understanding how I should push/pull so that the top level folder of my GitHub repo isn't included.

Answer: had to change git clone git@github.com:username/reponame.git to git clone git@github.com:username/reponame.git . - that period at the end ignores the top level folder.

David Cain
  • 16,484
  • 14
  • 65
  • 75
Ix Techau
  • 71
  • 7
  • `git` will pull what you had `git commit`ed. So, you can `git commit` only a particular path or file, and then `git push`. So don't use `git commit -a` – Gilles Quénot Mar 26 '13 at 22:25
  • I did the following: Went into the folder on the server through SSH, then: git clone git@github.com:username/reponame.git – Ix Techau Mar 26 '13 at 22:39

1 Answers1

0

To add to your answer, I would rather clone as a bare repo:

git clone --bare git@github.com:username/reponame.git /a/path/different/from/reponame

(no final dot here), in order to be able to:

  • push to that repo, using an ssh url ssh://yourServeerAccount@yourServer://a/path/different/from/reponame.git (you only push to a bare repo)
    See an example in "git push/clone to new server".
  • setup a hook which would cd to /demo/reponame and checkout HEAD in it: see this "post-receive hook example".
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250