Hi Junio & everyone, Several days ago, i reported a "git clone" issue, the url is at: http://marc.info/?l=git&m=131219022632724&w=2 Here i describe the problem again and try to provide a fix for this problem, please help to review it. Thanks. The problem: Suppose we have two git repositories on the local machine, one is called base repository, another is called source repository, source repository need refer to some objects of the base repository via .git/objects/info/alternates. If we set a relative path (source repository to base repository) in the alternates, we can execute any git commands (branch, tag, pull, checkout...) successfully in the source repository. But if we want to clone a destiantion repository from source repository without "--shared" on the same machine, just like this: %>git clone $local_path/src_repos $local_path/des_repos This clone command will fail because git can't get objects of the base repository. The reason: When we execute git clone $local_path/src_repos $local_path/des_repos, git will copy alternates of the src_repos to the des_repos first, then des_repos will use this alternates to refer to base repository, this is the problem, the relative in the alternates is src_repos to base_repos rather than des_repos to base_repos. The fix: After the alternates is copied from src_repos to des_repos and before this file is used by the des_repos, we can parse it and replace all relative paths to a corrected path (absolute path of base_repos or new relative path of des_repos to base_repos). In my patch, i choose to replace relative paths to absoulte paths of base_repos. If we add "--shared", this problem doesn't exist becase git doesn't need to copy alternates, if we add prefix before src_repos like "file://", "git://"..., this problem also doesn't exist. So i add a function to replace relative paths in the clone_local(), this only affect git clone $local_path/src_repos $local_path/des_repos without "--shared" and it has replative paths in the alternates of src_repos, for other situation, this function will not introduce any changes. Below is a execution result example of my fix: the content of the alternates in the source repos (4 lines): $<relative_path1_source_repos_to_base1> $<relative_path2_source_repos_to_base2> # comment line $<absolute_path_of_base3> After clone from source repos, the content of the alternates in the des_repos (4 lines): $<absolute_path_of_base1> $<absolute_path_of_base2> # comment line $<absolute_path_of_base3> -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html