![](/img/trans.png)
[英]What git command lines can i use to remove all my local directory on my computer?
[英]Can I change the default directory on my local drive for all Git activity?
所以我才开始使用Git和GitHub。 它仍然是一个陡峭的攀爬,但我开始喜欢它。 我在克隆存储库时注意到的一件事是,它总是下载到我的主文件夹/users/username
。 有办法改变吗?
我在Git手册中进行了搜索,并认为我可能可以使用--git-dir=GIT_DIR
,但是我知道我使用的方式不正确,因为当我尝试执行此操作时,Terminal中返回的内容是
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.
所以一定是错的...
除非另有指定,否则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
创建您的/path/to/my/files/repo
。
或者, git clone
可以采用指定位置的参数:
$ git clone me@host:/path/to/repo.git /other/path/to/repo
将在/other/path/to/repo
创建您的/other/path/to/repo
。
在Linux中键入pwd
(打印工作目录)。 这将显示git clone
将文件下载到的目录。
默认情况下,命令提示符将位于~
目录(即主目录)中。
您可以执行cd /home/barackObama/websites/whitehouse; git clone......
cd /home/barackObama/websites/whitehouse; git clone......
克隆到whitehouse文件夹中。
我在这里找到了一种简单的方法:
在快捷方式Git Bash上按鼠标右键,然后在其中更改开始位置:输入所需的启动目录。 确认。 做完了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.