Products Resources Support About Us

Rocket Software

During Clone change the directory?

When doing a clone it is easy to specify the directory where the clone is to be installed. But the clone will always go into a subdirectory of the specified directory using the name of the repository.

Is there a way to change that subdirectory name?

Hi lbdyck,

Are you sure that your statement is true, cause I can’t reproduce it:
syntax: git clone [–very-many-options…] repository [directory]
lets check it on pkgconf repo:

  1. git clone git@github.com:pkgconf/pkgconf.git
    clone will go to pkgconf subdirectory
    bash-4.3$ ls pkgconf/
AUTHORS             COPYING             Makefile.am         NEWS                autogen.sh          configure.ac        libpkgconf          m4                  meson.build         pkg.m4
CODE_OF_CONDUCT.md  Kyuafile.in         Makefile.lite       README.md           cli                 doc                 libpkgconf.pc.in    man                 meson_options.txt   tests
  1. git clone git@github.com:pkgconf/pkgconf.git pconf
    Clone will go to pconf directory without additional subdirectories
    bash-4.3$ ls pconf
AUTHORS             COPYING             Makefile.am         NEWS                autogen.sh          configure.ac        libpkgconf          m4                  meson.build         pkg.m4
CODE_OF_CONDUCT.md  Kyuafile.in         Makefile.lite       README.md           cli                 doc                 libpkgconf.pc.in    man                 meson_options.txt   tests
  1. git clone git@github.com:pkgconf/pkgconf.git /u/username/git/pc2
    Clone will go to /u/cskloc/git/pc2 directory without additional subdirectories
    bash-4.3$ ls /u/cskloc/git/pc2
AUTHORS             COPYING             Makefile.am         NEWS                autogen.sh          configure.ac        libpkgconf          m4                  meson.build         pkg.m4
CODE_OF_CONDUCT.md  Kyuafile.in         Makefile.lite       README.md           cli                 doc                 libpkgconf.pc.in    man                 meson_options.txt   tests

Thanks,
Alexander

I tried this with negative results:

/u/slbd>git clone git@github.com:xxxx/zzzz.git feature-branch /u/me/work
fatal: Too many arguments.

I’m trying to pull a specific branch and put it into a new directory to work with.

If I leave off the branch then it works - is there some trick that I’m missing?

Thanks

You need to use -b key to specify branch.

too simple - thank you - i knew i was missing something trivial but my eyes weren’t seeing it