Git Clone - 找不到存储库

时间:2014-09-20 08:56:18

标签: git github

git clone <url>

给消息致命:找不到存储库'url'

我尝试了link中的选项,但它没有用。

28 个答案:

答案 0 :(得分:205)

As mentioned by others the error may occur if the url is wrong.

However, the error may also occur if the repo is a private repo and you do not have access or wrong credentials.

Instead of

git clone https://github.com/NAME/repo.git

try

git clone https://username:password@github.com/NAME/repo.git


You can also use

git clone https://username@github.com/NAME/repo.git

and git will prompt for the password (thanks to leanne for providing this hint in the comments).

答案 1 :(得分:37)

在macOS上,git正在检索的Keychain中的缓存凭据可能是错误的。 它可能是过时的密码,也可能是使用了错误的凭据。

更新存储在OS X Keychain

中的凭据

按照以下说明操作:

https://help.github.com/articles/updating-credentials-from-the-osx-keychain/

如果要验证这是问题,可以使用跟踪运行克隆。

$ GIT_CURL_VERBOSE=1 git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

查找标题行&#34;授权:基本BASE64STRING&#34; 。
取base64字符串并对其进行解码以检查使用了什么用户名:密码。

$ echo <the key> | base64 --decode

确认它是您预期使用的正确用户名密码。

答案 2 :(得分:23)

最有可能的是,您的网址无效。

如果是http / https网址,您可以通过将网址钉入浏览器来快速检查。如果它根本不显示任何内容,则表示该URL无效。

我假设您说的是远程存储库。网址应该看起来像这样:

https://github.com/user/repo2.git if you're using HTTPS
git@github.com:user/repo2.git if you're using SSH

答案 3 :(得分:17)

我也有同样的问题。我试图克隆私有的repo,我在osx中​​安装的git有keychain,这不允许我克隆repo ...

我试过

git clone https://username:password@github.com/NAME/repo.git 

但它没有用,因为我的密码包含字段@。

我跑了

git credential-osxkeychain erase
host=github.com
protocol=https

命令并按回车键,它完全正常。实际上你需要删除已经存储在osx中​​的钥匙串。

答案 4 :(得分:16)

如果您在Windows上,则存储库是私有的,并且曾经保存过不同或不再正确的凭证,那么您将无权访问该存储库。您将得到未找到的错误,而不提示出故障凭证的方向。为了在Windows上重置凭据,请打开“控制面板”(Win + r控件),选择“用户帐户和凭据管理器”。在Windows凭据(不是Web凭据!)中找到git帐户,然后删除该条目。

此后,克隆将弹出一个登录对话框,您将能够再次进行设置。

使用git-bash作为VSCode中的shell测试了

答案 5 :(得分:12)

对我来说

git clone https://username@github.com/name/repo.git

的工作。

我认为这主要是因为私人回购无法直接访问。

答案 6 :(得分:9)

由于最初我使用错误的GitHub帐户登录,因此我遇到了同样的问题(peerRoundState, err := s.nodeview.PeerRoundStates() fmt.Println("This return value is slice pointer", peerRoundState) if err != nil { return nil, err } //PeerRoundStates this is type of slice. return &ConsensusResponse{ RoundState: s.nodeview.RoundState().RoundStateSimple(), PeerRoundStates: peerRound, }, nil )。要解决此问题:

  1. 从“开始”菜单中打开控制面板。
  2. 选择用户帐户。
  3. 在左侧菜单中选择“管理您的凭据”。
  4. 删除与Git或GitHub相关的所有凭据。

答案 7 :(得分:9)

什么解决了我的问题,因为我有一个&#34;重定向/ sign_in网址&#34;或&#34;未找到存储库&#34;错误

MacOS用户:

  1. 打开聚光灯(命令空间)
  2. 键入钥匙串(打开钥匙串access.app)
  3. 搜索回购域名(GitHub,GitLab等)
  4. 删除与此域名相关的所有密钥
  5. 尝试再次克隆(使用有效凭据)
  6. Windows用户应尝试类似的步骤,但Keychain将改为Microsoft的凭据管理器或Windows凭据,具体取决于您的操作系统版本。如果是这样的话,请务必清除网页和Windows凭据。

    欢呼声

答案 8 :(得分:7)

在github上,您可以拥有主存储库和子文件夹。确保您使用的URL是主存储库的URL,而不是文件夹的URL。前者将成功,后者将产生未找到存储库的错误。如果您怀疑自己位于子文件夹中,请在存储库链中向上导航,直到找到实际指定了https URL的页面并使用该页面。

答案 9 :(得分:4)

如果您为Github帐户使用双因素授权(2FA),那么只需使用SSH选项来克隆您的存储库:

enter image description here

答案 10 :(得分:3)

enter image description here

第 1 步: 从 HTTPS 复制链接

第2步:在本地仓库做

git remote rm origin

第 3 步:将复制的 url 中的 github.com 替换为 username.password@github.com

第 4 步:

git remote add origin url

答案 11 :(得分:2)

之所以发生这种情况,是因为我保留了其他用户的旧会话状态:以下是Windows用户的快速解决方案,

从“开始”菜单中打开控制面板 选择用户帐户 在左侧菜单中选择“管理您的凭据” 删除与Git或GitHub相关的所有凭据

一旦我这样做,它就会开始为我工作。

答案 12 :(得分:2)

git clone https://username@github.com/User/Repository.git将提示您输入密码,然后进行克隆。

答案 13 :(得分:2)

对我来说,它通过删除credential.helper配置并再次克隆存储库来工作

git config --global --unset credential.helper
git clone https://<repository>

答案 14 :(得分:1)

您可能需要在存储库目录中创建一个名为git-daemon-export-ok的空文件。

答案 15 :(得分:0)

我最近遇到了这个问题,经过大量调试后,我意识到我从密码生成器获得的密码中有一个“&”,GitHub 接受了它,但 Visual Studio Code 在我尝试时不喜欢克隆 reopo。不确定是哪个系统引发了错误,但它让我意识到您的用户名或密码中的阶段字符也可能导致此问题。

答案 16 :(得分:0)

git clone https://<USERNAME>@github.com/<REPONAME>/repo.git

这很好用。需要提供密码。

答案 17 :(得分:0)

如果您的git仓库是私人的,请尝试

git clone https://<USERNAME>:<PASSWORD>@github.com/<USERNAME>/<REPO_NAME>.git

其他用途

git clone https://github.com/<USERNAME>/<REPO_NAME>.git

答案 18 :(得分:0)

对我来说,出现问题是因为我为gitlab保存了旧的用户名/密码设置,因此我需要删除这些凭据。我在Mac上运行以下命令:

sudo su
git config --system --unset credential.helper

然后再次进行克隆,输入用户名和密码。一切都很好。

答案 19 :(得分:0)

此错误的另一个原因,如果您在github上,并尝试对多个存储库使用部署密钥,则会发现此方法不起作用。

在这种情况下,您需要创建一个machine user,但是如果您没有这样做,并且您尝试克隆具有部署密钥的仓库以外的任何仓库,则会出现此错误。

答案 20 :(得分:0)

您应该检查是否还有其他标记为“默认”的github帐户。尝试克隆新存储库时,客户端(在我的情况下为BitBucket)将尝试获取您设置为“默认”的凭据。只需将您的新凭据标记为“默认”,它将允许您克隆存储库,这对我有用。

答案 21 :(得分:0)

就我而言。存储库是私有的,我无法直接访问它。一种使用Github Desktop应用程序获取此存储库的简便方法。

答案 22 :(得分:0)

enabled GitHub 2FA之后,此问题开始在我的终端上出现。

现在,无论何时克隆私有存储库,我都会遇到此问题。错误:

  

远程:未找到存储库。
  致命:找不到存储库“ https://github.com/kmario23/repo-name.git/

太尴尬了。当然,我有这个仓库,我是它的所有者。

无论如何,看来现在的解决方法是,在克隆私人存储库时,我们不得不再次进入GitHub package main import ( "fmt" "math/rand" "time" ) const length = 1000 var start time.Time var rez [length][length]int func main() { const threadlength = 1 toCalcRow := make(chan []int) toCalcColumn := make(chan []int) dummy1 := make(chan int) dummy2 := make(chan int) var row [length + 1]int var column [length + 1]int var a [length][length]int var b [length][length]int for i := 0; i < length; i++ { for j := 0; j < length; j++ { a[i][j] = rand.Intn(10) b[i][j] = rand.Intn(10) } } for i := 0; i < threadlength; i++ { go Calc(toCalcRow, toCalcColumn, dummy1, dummy2) } start = time.Now() for i := 0; i < length; i++ { for j := 0; j < length; j++ { row[0] = i column[0] = j for k := 0; k < length; k++ { row[k+1] = a[i][j] column[k+1] = b[i][k] } rowSlices := make([]int, len(row)) columnSlices := make([]int, len(column)) copy(rowSlices, row[:]) copy(columnSlices, column[:]) toCalcRow <- rowSlices toCalcColumn <- columnSlices } } dummy1 <- -1 for i := 0; i < length; i++ { for j := 0; j < length; j++ { fmt.Print(rez[i][j]) fmt.Print(" ") } fmt.Println(" ") } <-dummy2 close(toCalcRow) close(toCalcColumn) close(dummy1) } func Calc(chin1 <-chan []int, chin2 <-chan []int, dummy <-chan int, dummy1 chan<- int) { loop: for { select { case row := <-chin1: column := <-chin2 var sum [3]int sum[0] = row[0] sum[1] = column[0] for i := 1; i < len(row); i++ { sum[2] += row[i] * column[i] } rez[sum[0]][sum[1]] = sum[2] case <-dummy: elapsed := time.Since(start) fmt.Println("Binomial took ", elapsed) dummy1 <- 0 break loop } } close(dummy1) } 。下面是一个示例:

username

答案 23 :(得分:0)

可能您确实登录了另一个帐户,并且该帐户没有对此仓库的访问权限,如果您使用的是Mac OS,请转到“钥匙串访问”,搜索gitlab.com并将其删除并尝试进行git clone再次。

答案 24 :(得分:0)

身份验证问题: 我使用TortoiseGit GUI工具,我需要告诉Tortoise用户名和密码,以便它可以与Git / GitHub / Gitlab代码库一起使用。 说出来 在任何文件夹内单击以获取TortoiseGit菜单。 在这里TortoseGit>设置窗口>在左侧导航树中选择凭据 输入 网址:Git网址 助手:如果您的Windows凭据与Git的凭据相同,则选择Windows;如果它们不同,则选择“经理” 用户名; Git用户名 保存此设置,然后重试。系统将提示您输入密码,然后密码生效。

答案 25 :(得分:0)

如果您将cygwin用于git并尝试从网络驱动器克隆git存储库,则需要添加cygdrive路径。

例如,如果您要从z:/

克隆git repo

$ git clone /cygdrive/z/[repo].git

答案 26 :(得分:-1)

我是一名devops工程师,这在私有存储库中发生。由于我管理多个Github组织,所以我有一些不同的SSH密钥。要克服此ERROR: Repository not found. fatal: Could not read from remote repository.错误,您可以使用

export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o User=git -i ~/.ssh/ssh_key_for_repo"

git clone git@github.com:user/repo.git

答案 27 :(得分:-3)

打开凭据管理器->查找您的GIT devops配置文件->单击它->编辑->添加在DevOps中生成的用户和密码并保存。

相关问题