我有两个git存储库:
我丢了report.git.我有cloned.git.我想从这个cloned.git克隆其他存储库.这是可能的,但我的问题是我错过了什么?cloned.git和master report.git真的一样吗?
cloned.git仍指向Master report.git.我通过删除.git/config中的选项来改变这一点.这够了吗?
一个朋友被困在一个旧版本的Git(我认为他说1.5?),他说这个-b <branch>选项不受支持.我无法绕过它,所以我真的希望有人可以提供帮助:
什么是相当于以下命令,没有使用-b?
git clone -b $BRANCH $REPO
Run Code Online (Sandbox Code Playgroud)
编辑:我最初要求git checkout- 这不是我的意思.抱歉!
我已经在 BitBucket 克隆、拉取并获取了我的远程 git 存储库。但是我只能得到master分支。我在 BitBucket 的 repo 有 4 个分支:

我已经找到了这个和那个的两个问题。我遵循了这些问题中的一些说明。
当我尝试时git branch -a,我看不到其他三个分支。
*master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
我试过了git checkout origin/fix/cleanup。我收到一条错误消息。
错误:pathspec 'origin/fix/cleanup` 与 git 已知的任何文件都不匹配。
我试过了checkout -b,但又出现了一个错误。
$ git checkout -b fix/cleanup origin/fix/cleanup
fatal: Cannot update paths and switch to branch 'fix/cleanup' at the same time.
Did you intend to checkout 'origin/fix/cleanup' which can not be resolved as com
mit?
Run Code Online (Sandbox Code Playgroud)
我也尝试执行oneliner。
for remote …Run Code Online (Sandbox Code Playgroud) 我编写了代码,通过 libgit2sharp ( v0.21.0.176 ) 以编程方式将 GitHub 私有存储库克隆到本地存储库
var cloneOptions = new CloneOptions { BranchName = "master", Checkout = true };
var cloneResult = Repository.Clone( @"https://github.com/my-organization/my-repo.git", @"c:\github\my-organization\my-repo" );
Run Code Online (Sandbox Code Playgroud)
抛出异常:
{LibGit2Sharp.LibGit2SharpException: Request failed with status code: 401
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
Run Code Online (Sandbox Code Playgroud)
cloneResult 值为空(由于抛出异常而从未设置)
请注意,无论 \my-repo\ 文件夹是否存在,都会抛出相同的 401 异常。
我的函数调用语法正确吗?
从命令行执行,git clone首先创建要克隆到的本地 dir 文件夹。
libgit2sharp 的Repository.Clone()工作方式不同吗?
我在使用 git clone 时遇到了问题。当我运行命令克隆存储库时,git 命令看起来成功完成。
git clone ssh://username@192.168.2.4:29418/sourceName
Run Code Online (Sandbox Code Playgroud)
我得到以下结果:
ssh://username@192.168.2.4:29418/sourceName
Cloning into 'sourceName'...
Warning: Permanently added '[192.168.2.4]:29418' (RSA) to the list of known hosts.
remote: Counting objects: 14091, done
remote: Finding sources: 100% (14091/14091)
remote: Total 14091 (delta 10639), reused 13901 (delta 10639)
Receiving objects: 100% (14091/14091), 84.60 MiB | 204.00 KiB/s, done.
Resolving deltas: 100% (10639/10639), done.
Checking connectivity... done.
Run Code Online (Sandbox Code Playgroud)
所以,看起来它克隆成功了。但是当我查看目标文件夹时,我只看到 .git 文件夹被创建和填充。
没有源文件作为克隆的一部分在本地复制。
我没有看到任何错误消息。可能出什么问题了?我如何“调试”这个?
谢谢,约翰B
git clone --depth <depth> <url> <repo>; git -C <repo> rev-list --count --all != <depth>
git clone --depth <depth>:创建一个具有截断为<depth>提交的历史记录的克隆.意味着--single-branch.
例如:url = https://github.com/vhf/free-programming-books.git,depth = 10,然后commit_count = 15
git version 2.9.0
我的同事允许我以 Master 身份访问他的存储库,然后我使用 SSH 和 HTTPS 克隆它,但它总是失败:
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我一直在检查.pub文件中生成的公钥并已插入到我的 Gitlab 帐户中。而且我还尝试克隆一个存储库(来自其他所有者),并且可以正常工作!这很混乱。
我错过了什么吗?
我是 git 新手。我了解 git 基础知识以及使用 git 的开发过程,但是有一件事让我感到困惑。
每当我必须从包含多个项目的 git 存储库中提取某些内容时(示例),我都会看到以下说明步骤:
这对我来说有点令人费解。由于我已经拥有整个存储库,如果我可以复制文件夹并对其进行任何我喜欢的操作,我为什么要签出我感兴趣的项目?
我正在开发一个项目,我需要在 div 中添加拖放,然后我开始查看拖放库,这些库也应该适用于移动设备,并找到了一个名为Dragula 的库。
我试图在我的机器上克隆存储库。我下载了看起来像这样的 git,但问题是我无法从 GitHub 克隆特定的库,
git ×10
git-clone ×10
github ×5
clone ×2
git-branch ×2
bitbucket ×1
fatal-error ×1
git-checkout ×1
gitlab ×1
homebrew ×1
libgit2sharp ×1
ssh ×1