【问题标题】:Issues pushing to private git repositories in linux推送到 linux 中的私有 git 存储库的问题
【发布时间】:2015-06-06 01:24:01
【问题描述】:

您好,我有以下 git 私人仓库

git remote -v
origin  https://github.com/sescobb27/festinare_api.git (fetch)
origin  https://github.com/sescobb27/festinare_api.git (push)
ssh git@github.com:sescobb27/festinare_api.git (fetch)
ssh git@github.com:sescobb27/festinare_api.git (push)

但是当我尝试运行 git push origin master 时,它会说

remote: Repository not found.
fatal: repository 'https://github.com/sescobb27/festinare_api.git/' not found

但是如果我改为运行 git push ssh master 它可以工作,我不知道发生了什么或为什么会发生这种情况;奇怪的是他们上周还在工作。

我在 xubuntu xfce 14.04LTS

更新

git config --local -l

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
credential.helper=store
remote.origin.url=https://github.com/sescobb27/festinare_api.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.ssh.url=git@github.com:sescobb27/festinare_api.git
remote.ssh.fetch=+refs/heads/*:refs/remotes/ssh/*

【问题讨论】:

    标签: linux git github


    【解决方案1】:

    https 推送应该询问您的凭据(github 登录“escobb27”和 GitHub 密码):然后它应该可以工作。
    如果它不要求提供凭据,那么它可能会从 credential helper 中挑选一些可能​​缓存错误的凭据。
    在任何情况下,具有错误凭据的私有仓库将始终返回“404: not found”。

    ssh 推送可以直接工作,因为用于验证您身份的公共 ssh 密钥已添加到 GitHub 上的私有存储库中。

    我建议在 cmets 中尝试,怀疑 .gitconfig 中有错误:

    git remote set-url origin https://sescobb27@github.com/sescobb27/festinare_api
    

    OP 确认:

    我已经修复了它,我的.gitconfig 文件中有一个错误,一旦我修复它,git 开始按预期工作,但错误并不明显

    我认为错误是缩进和混合制表符与空格,但我不确定。没有将 vim 配置为将制表符转换为空格,所以会造成混乱。

    【讨论】:

    • 是的,我正在缓存我的凭据,它们没问题,如果我在我的 .gitconfig 中禁用缓存,错误仍然会发生,但现在我在 OSX 电脑上并且错误仍然存​​在发生但我能够推送给其他人回购(私人和公共的)。我正在查看我的 github 帐户,它说 Micro – Using 5 of 5 private repositories. 是 github 阻止我通过 https 推送,因为我用尽了我的私人仓库?
    • @sescob27 很有可能,如果 festinare_api 是你的第六个私人仓库。
    • @sescob27 但至少我想指出为什么 ssh 会起作用。如果它确实有效,那应该意味着 festinare_api 是 5 个私有存储库的一部分。
    • 我删除了 2 个私有仓库,现在我只有 3 个私有仓库,但问题仍然存在 :(,你知道如何解决吗?我需要推送 https,因为我在哪里学习ssh 的 22 端口被阻止,所以我无法推送更改
    • @sescob27 你能用git config --local -l 的副本编辑你的问题吗?只是看看那里是如何确切地指定远程来源的 url。
    猜你喜欢
    • 2019-08-30
    • 2017-06-29
    • 2011-12-27
    • 1970-01-01
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 1970-01-01
    相关资源
    最近更新 更多