4

I've got a website on a VPS and I'd like to create an offline clone using Git.

So what I did on my VPS:

git init
git add .
git commit -m "comment"

Which created a .git folder. I am not sure now how I am supposed to continue in order to clone the git repository to my local machine.

I've tried using: git clone ssh://user@IP/home/user/.git but I get the following messages:

fatal: '/home/user/.git' does not appear to be a git repository 
fatal: Could not read from remote repository.

Can you please let me know what I am missing here?

5
  • 3
    To clone the repo you need to indicate the path to the project and not the path to the .git folder Commented May 5, 2015 at 9:36
  • @JoëlSalamin So instead of /home/user/.git just /home/user/ ? Because that didn't work either. Unless you mean something else.. Commented May 5, 2015 at 9:41
  • 1
    what is the error thrown now? Commented May 5, 2015 at 9:42
  • 1
    all you need is one command, git clone ssh://[email protected]:port/remote/dir/public_html /home/user/local/dir Commented May 5, 2015 at 9:42
  • possible duplicate of Git "does not appear to be a git repository" Commented May 5, 2015 at 11:25

1 Answer 1

4

you should just "ignore" the existence of the .git directory:

git clone ssh://user@IP:/home/user/

should do the trick (if ssh user@IP works of course).

NOTE: not sure it's a good idea to make your whole "user" directory a git repository. using a subdirectory is probably a good idea.

EDIT: in this case file permissions were also an issue in copying files from a linux pc to a windows pc...

Sign up to request clarification or add additional context in comments.

5 Comments

Hello Chris, doing this I still get the same error fatal: '/home/user/' does not appear to be a git repository fatal: Could not read from remote repository. I've also got .gitignore to ignore everything but public_html which I want to copy
in which directory did you do the git init command? I suppose in /home/user/ ?
Yes, I did it on /home/user/ and the .git folder is under there. I've also checked ssh which works.
then I suggest you to try it out locally first: create a temporary dir; make it a git repository; and clone it to another directory; check if that works...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.