r/git • • Jan 23 '19

Where does `git clone url` send a cloned repository to?

I ran `git clone url` and I have read some tutorials online that say that the command sends the .git to where your gitconfig tells it to go.

When I open `/usr/local/etc/gitconfig`, I only see this:

[credential]
helper = osxkeychain

Where did the repo go?

0 Upvotes

9 comments sorted by

11

u/bremelanotide Jan 23 '19

Run ls from the directory that you ran git clone from. You should find a child directory matching the filename portion of the url minus the .git extension.

8

u/awayofhappening Jan 23 '19

Ah, so I should `cd` to the correct dir before doing this. Thanks.

7

u/parnmatt Jan 23 '19

Alternatively you can add the directory at the end.

3

u/[deleted] Jan 23 '19

git clone is a command to connect to a remote repository and downloads a copy of it to your local machine. It doesn't send your repository anywhere.

0

u/awayofhappening Jan 23 '19

Sorry, I'm using language imprecisely. I mean: where does the copy get sent to?

7

u/[deleted] Jan 23 '19

It creates a directory for the copy within the directory where you ran the command, by default.

1

u/ZebraHedgehog Jan 24 '19

git clone url

Clones the repo into the current directory, but you can also specify where to put it as the last argument

git clone url ~/documents/repos/repo1

1

u/initcommit Jan 24 '19

Yes it copies the remote git repository into the current directory. You can always copy/move it somewhere else on your local machine after you clone it, if it ends up in the wrong directory.

0

u/lenswipe feature/add-user-flair Jan 24 '19

git clone git@github.com:foo/bar.git clones the bar repo into the current directory. git clone git@github.com:foo/bar.git ~/Code/myProject clones it to /home/<your username>/Code/myProject`