0

I am a beginning programmer going through this Test-Driven-Development tutorial. I've reached the chapter where I need to spin up a server and register some domain names that I can then use with my Django project and I've been able to do everything up until now.

This step in the tutorial has me git clone my repo into the server, switch to the repo directory, and then run python3 manage.py runserver to get the expected "django is not installed on the server" error.

The problem is that while it appears my repo has been successfully cloned, I cannot see the directory. Here is the error I am seeing:

user@ip-172-31-41-131:~$ git clone https://github.com/user/superlists.git \~/sites/$SITENAME/source
Cloning into '~/sites/staging.user.com/source'...
remote: Counting objects: 530, done.
remote: Compressing objects: 100% (363/363), done.
remote: Total 530 (delta 153), reused 521 (delta 148), pack-reused 0
Receiving objects: 100% (530/530), 699.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (153/153), done.
Checking connectivity... done.
user@ip-172-31-41-131:~$ cd ~/sites/$SITENAME/source
-su: cd: /home/user/sites/staging.user.com/source: No such file or directory

I had assumed that since Git successfully cloned into ~/sites/$SITENAME/source that the directory would have been automatically created. But when I went looking I couldn't find it:

user@ip-172-31-41-131:~$ cd sites
user@ip-172-31-41-131:~/sites$ ls
staging.user.com
user@ip-172-31-41-131:~/sites$ cd staging.user.com
user@ip-172-31-41-131:~/sites/staging.user.com$ ls
database  static  virtualenv

This is my first posted question on SO. I have been here MANY times before and always look to see if anyone else has the same problem/question as me, but I could not find anyone else who has encountered this - although I'll admit I'm not sure the best way to ask it.

Full disclaimer: The tutorial strongly suggests using Django v1.8, however I have been using v1.9 and have been able to search for any weird errors until now, but I can't see how that would matter since Django isn't even installed on the server. If I am wrong then I look forward to being enlightened.

SeanMcD
  • 3
  • 3
  • 1
    `cd \~/sites/$SITENAME/source`. You should add \ before ~ or ~ is interpreted as /home/username/ instead. But try not to use ~ as part of a new path name. You could also use `cd '~/sites/$SITENAME/source'` – ElpieKay May 27 '16 at 05:05

1 Answers1

3

The problem is that you are escaping the ~ in the destination path, so it is being treated literally instead of expanding to your home directory (you will now have a directory called ~ the root of your filesystem!).

This should work:

$ git clone https://github.com/user/superlists.git ~/sites/$SITENAME/source

(note, no backslash before the ~). git should also tell you the expanded path that it is cloning into:

Cloning into '/home/user/sites/staging.user.com/source'...
solarissmoke
  • 30,039
  • 14
  • 71
  • 73
  • Thanks, this worked. The "\" was in the tutorial example I'm using and I, being the newbie that I am, took it literally. Sure enough, in the root of my filesystem I had two directories named `~`. – SeanMcD May 27 '16 at 16:13