简体   繁体   中英

correct syntax for git remote clone

How can I clone a git repository remotely to a Rails application directory on the same server as the repository?

If I do the following, the cloned repository ends up on my local/Windows machine, which is not what I want:

git clone -q username@server.com:/users/home/jdquirke/git/deq.git \
    /users/home/username/rails_apps/deq/releases/20130305205259

If I do the following instead,

git clone -q username@server.com:/users/home/jdquirke/git/deq.git \
    username@server.com:/users/home/username/rails_apps/deq/releases/20130305205259

I get

fatal: could not create leading directories of 'username@server.com:/users/home/jdquirke/rails_apps/deq/releases/20130305205259': Invalid argument

It looks to me as though my problem centers around how to tell the clone command the remote directory that I want the clone to go to.

I don't know if you can do this with just a git command, but you can do it with an ssh command executing git on the remote server.

Eg something like this:

ssh steinar@delta "git clone git@delta:private.git /tmp/git-test/private"

Note that I have separate users for git and for executing commands on the server. That may or may not be the case for you, depending on how git is set up on the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM