当前位置:  开发笔记 > 前端 > 正文

我可以更改本地驱动器上所有Git活动的默认目录吗?

如何解决《我可以更改本地驱动器上所有Git活动的默认目录吗?》经验,为你挑选了1个好方法。

所以我刚开始使用Git和GitHub.它仍然是一个陡峭的攀登,但我开始喜欢它.我克隆存储库时注意到的一件事是它总是下载到我的主文件夹/users/username.有没有办法改变这个?

我去搜索Git手册并认为我可能会使用--git-dir=GIT_DIR,但我知道我使用它不正确,因为当我尝试这个时,终端返回的是

       git --git-dir=New/Directory/Path/
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
           [--help] COMMAND [ARGS]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

See 'git help COMMAND' for more information on a specific command.

所以一定是错的......



1> mipadi..:

git clone将文件复制到当前目录中的任何内容,除非您另行指定.那么,如果您当前的工作目录是~,那么

$ git clone me@host:/path/to/repo.git

将文件复制到~/repo.

您可以通过以下两种方式之一进行更改:

cd 首先到所需的目录:

$ cd /path/to/my/files
$ git clone me@host:/path/to/repo.git

将创建您的回购/path/to/my/files/repo.

或者,git clone可以采用指定位置的参数:

$ git clone me@host:/path/to/repo.git /other/path/to/repo

将创建您的回购/other/path/to/repo.

推荐阅读
mobiledu2402851373
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有