git-clone

How to clone seed/kick-start project without the whole history?

孤街醉人 提交于 2019-11-27 19:17:35
问题 Note that using --depth=1 parameter prevents you from pushing the project to a new repository . for details see: "Remote rejected" (shallow update not allowed) after changing Git remote URL 回答1: You can do a git clone <git_url> delete the .git repository from your folder. Which will delete all your history. The you can do a git init which will create an entirely new git project for you. This may not be the best way. But this will work . Hope it helps. 回答2: As long as you consider full loss of

Git clone particular version of remote repository

我只是一个虾纸丫 提交于 2019-11-27 16:43:16
I cloned a remote git repository about a month ago. The remote repository has undergone many changes and has now become unstable. Now I need another copy of the repository, version identical to the one I cloned a month ago. How do I do this? You could "reset" your repository to any commit you want (e.g. 1 month ago). Use git-reset for that: git clone [remote_address_here] my_repo cd my_repo git reset --hard [ENTER HERE THE COMMIT HASH YOU WANT] M.Othman You Can use simply git checkout commithash in this sequence git init git clone `URLTORepository` cd `into your cloned folder` git checkout

How to get Git to clone into current directory

主宰稳场 提交于 2019-11-27 16:34:07
I'm doing: git clone ssh://user@host.com/home/user/private/repos/project_hub.git ./ I'm getting: Fatal: destination path '.' already exists and is not an empty directory. I know path . already exists. And I can assure that directory IS empty. (I do ls inside and I see nothing!) What am I missing here in order to clone that project into the current directory ? Roshan Pal simply put a dot next to it git clone git@github.com:user/my-project.git . From git help clone : Cloning into an existing directory is only allowed if the directory is empty. So make sure the directory is empty (check with ls

Why Isn't There A Git Clone Specific Commit Option?

倖福魔咒の 提交于 2019-11-27 12:24:59
In light of a recent question on SO , I am wondering why isn't there an option in git clone such that the HEAD pointer of the newly created branch will point to a specified commit? In say question above, OP is trying to provide instructions on the specific commit his users should clone. Note that this question is not about How To Clone To A Particular Version using reset ; but about why isn't there ? Two answers so far (at the time I wrote this, now there are more) are correct in what they say, but don't really answer the "why" question. Of course, the "why" question is really hard to answer,

Why do some repository URLs end in .git while others don't?

放肆的年华 提交于 2019-11-27 11:30:09
问题 When I clone a repository, is there any difference between these two URLs? Without .git extension: git clone http://foo/repo With .git extension: git clone http://foo/repo.git 回答1: The convention is that the .git extension should be used for bare repositories, and left off of directories with a working tree. Git doesn't really care, but has a few convenience methods that make this fairly transparent. For example, if you have a repository named /tmp/foo.git and you call git clone file:///tmp

How to update a git shallow clone?

99封情书 提交于 2019-11-27 11:15:00
Background (for tl;dr, see #questions below) I have multiple git repository shallow clones. I'm using shallow clones because it's a lot smaller compared to a deep clone. Each is cloned doing about git clone --single-branch --depth 1 <git-repo-url> <dir-name> . This works fine, except I don't see how to update it. When I'm cloning by a tag, update is not meaningful, as a tag is frozen point in time (as I understand it). In this case, if I want to update, this means I want to clone by another tag, so I just rm -rf <dir-name> and clone again. Things get more complicated when I’ve cloned the HEAD

Git svn clone: How to defer fetch of revision history

狂风中的少年 提交于 2019-11-27 11:03:55
问题 I often have the case that I want to work on a SVN repository right away. But an ordinary git svn clone [url] also clones the entire history. So I want to speed things up. The first part is to fetch only the last revision into your Git repository. I do it like so: URL=http://google-web-toolkit.googlecode.com/svn/trunk/ REV=`svn info $URL |grep Revision: | awk '{print $2}'` PROJECT_FOLDER=google-web-toolkit-readonly git svn clone -r$REV:HEAD $URL $PROJECT_FOLDER (more info in the StackOverflow

Git clone without .git directory [duplicate]

瘦欲@ 提交于 2019-11-27 10:12:18
Possible Duplicate: How to do a “git export” (like “svn export”) Is there a flag to pass to git when doing a clone, say don't clone the .git directory? If not, how about a flag to delete the .git directory after the clone? Adam Dymitruk Use git clone --depth=1 --branch=master git://someserver/somerepo dirformynewrepo rm -rf ./dirformynewrepo/.git The depth option will make sure to copy the least bit of history possible to get that repo. The branch option is optional and if not specified would get master. The second line will make your directory dirformynewrepo not a Git repository any more. If

Retrospectively add --recursive to a git repo

穿精又带淫゛_ 提交于 2019-11-27 09:39:48
问题 If you git clone with --recursive , you can get all the git submodules too. If I've forgotten to add this magical flag when cloning, as can happen, how do I now go and get any submodules? Additionally, how can I set the recursive flag as a default for future clones? 回答1: You can do it with this after a simple top-level clone: git submodule update --init --recursive I would not recommend making clone do this by default. The proper way to do this if you are using submodules aggressively for

How to stop git via ssh on windows from resolving the wrong path?

爷,独闯天下 提交于 2019-11-27 06:16:00
问题 I have a windows 2003 box with an ssh server setup. I have msysgit (git version 1.6.2) installed both locally and on the server. The server has the following absolute path to my repos: e:\vc\git\myrepo.git when a user logs in he/she will be put in the following working directory: e:\vc\git\ When running the following cmd on my dev machine: git clone ssh://myuser@myip/myrepo.git testrepo I get the following error: fatal: ''/myrepo.git'' does not appear to be a git repository According to my