Reputation: 31387
I'm trying to clone a project that is remotly located to my local machine.
So:
1) I navigate to the local folder where I want to have my files.
2) I connect to ssh on the remote machine: ssh something@server.webserver.com/devproject.git/
3) I execute the git clone command: git clone ssh://something@server.webserver.com/devproject.git/
I get: fatal: destination path 'devproject' already exists and is not an empty directory.
I don't have devproject on my local machine. I've checked and re-checked.
What am I missing ?
Thanks.
Upvotes: 0
Views: 3185
Reputation: 1328842
Note: independently of the ssh issue, you can see all possible git clone url/arguments
possible in t/t5603-clone-dirname.sh
.
A first version of that file revealed some failed cloned commands when the url ends with trailing slash(es), git 2.4.8 (August 3rd, 2015, fixed in upcoming 2.5.1, Sept. 2015):
test_clone_dir ssh://host/foo.git/ foo fail
test_clone_dir ssh://host/foo.git/// foo fail
test_clone_dir host:foo.git/ foo fail
test_clone_dir host:foo.git/// foo fail
See commit db2e220, commit d6a31e0 (10 Aug 2015) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 52f6893, 25 Aug 2015)
clone
: use computed length inguess_dir_name
Commit 7e837c6 (
clone
: simplify string handling inguess_dir_name()
, 2015-07-09) changed clone to use strip_suffix instead of hand-rolled pointer manipulation.
However,strip_suffix
will strip from the end of a NUL-terminated string, and we may have already stripped some characters (like directory separators, or "/.git
").
This leads to commands like:
git clone host:foo.git/
failing to strip the "
.git
".
Note that, with Git 2.34 (Q4 2021), more parts of "git submodule add
"(man) has been rewritten in C.
That involves guess_dir_name()
, which was used by those scripts, and is refactored:
See commit de0fcbe, commit 15fe88d, commit ba8a3b0, commit f006132, commit a6226fd, commit ed86301, commit 0c61041, commit ab6f23b, commit 6baf4e4 (10 Aug 2021) by Atharva Raykar (tfidfwastaken
).
See commit 59dcbb8 (10 Aug 2021) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit bbeca06, 20 Sep 2021)
dir
: libify and export helper functions fromclone.c
Signed-off-by: Atharva Raykar
Mentored-by: Christian Couder
Mentored-by: Shourya Shukla
These functions can be useful to other parts of Git.
Let's move them todir.c
, while renaming them to be make their functionality more explicit.
Upvotes: 0
Reputation: 4053
I don't know if this is the reason, but your clone URL (ssh://something@server.webserver.com/devproject.git/
) has a trailing slash at the end. Maybe that's what is causing this?
Upvotes: 0
Reputation: 301507
You are sshing into the server and trying to clone OVER your repo. That is why you get fatal: destination path 'devproject' already exists and is not an empty directory.
Don't ssh into the server. Skip that part.
Upvotes: 2
Reputation: 4042
Are you executing step 3 on your local machine or over your SSH connection? Try skipping step 2.
Upvotes: 2
Reputation: 90027
Any commands you type after sshing to the remote machine are executed on that machine, not on your local machine. Cut out step #2.
Upvotes: 2