I have given access to server, and want to clone git repo into my root folder. But when I do git clone it will make me folder with project name, and my project folder is my root. I dont have access to my parent folder my root is
/var/www/sites/mysite/
and when I do cloning folder structure will be
/var/www/sites/mysite/mysite
You can specify the destination directory as second parameter of the git clone command, so you can do: git clone <remote> . This will clone the repository directly in the current local directory. This works only if current directory isn't empty.
You can now clone your new repository by doing the following: git clone /org/centers/foo/repos/private/bar Initialized empty Git repository in /tmp/bar/. git/ warning: You appear to have cloned an empty repository. As you can see, the --all created the remote master branch for you.
Cloning only a subdirectory is not possible in Git. The network protocol doesn't support it, the storage format doesn't support it.
git clone
accepts a last argument that is the destination directory, it is by default the name of the project but you can change it. In your case you probably want simply .
:
$ git clone origin-url .
But note that, from man git-clone
:
Cloning into an existing directory is only allowed if the directory is empty.
You can also just setup a new repo and then the tracking remote and branch:
git init . git remote add origin [email protected]:user/repo.git git fetch origin git checkout master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With