【问题标题】:"git push" failed: "You did not specify any refspecs to push"“git push”失败:“您没有指定要推送的任何参考规范”
【发布时间】:2023-03-26 14:13:01
【问题描述】:

我在 projectlocker 上设置了一个 git 项目来将我的 git 文件推送到。然后我进入初始化 git 项目并暂存文件的目录。最后,我尝试使用以下命令将项目推送到 projectlocker:

$ git push git-smichaels@free5.projectlocker.com:helloworld.git

它会产生这个错误:

warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated.  This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning:   'nothing'  : Do not push anything
warning:   'matching' : Push all matching branches (default)
warning:   'tracking' : Push the current branch to whatever it is tracking
warning:   'current'  : Push the current branch
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

这样推有什么问题吗?

我发现 an example 有人使用这种语法:

git remote add myproject 'git-myloginname@projectlocker.com:myproj.git'
git push myproject +master:master 

是否有必要使用“remote add” - 为什么我不能像上面那样直接推送到 URL?

【问题讨论】:

    标签: git git-push


    【解决方案1】:

    这是真正的错误。您没有存储库的读取权限?

    ERROR:gitosis.serve.main:Repository read access denied
    

    其余的只是警告。如果您想摆脱警告,请执行以下操作:

    git push git-smichaels@free5.projectlocker.com:helloworld.git [branchname]
    

    如果您希望 Git 在未指定 [branchname] 时推送当前分支而不发出警告,请执行以下操作:

    git config push.default current
    

    【讨论】:

    • git config push.default 当前 ssh://@:29418/demo/gerrittest.git
    【解决方案2】:

    你真正的问题隐藏在警告信息中

    ERROR:gitosis.serve.main:Repository read access denied
    

    确保您能够访问存储库

    【讨论】:

      【解决方案3】:

      我使用 ProjectLocker。您可以在 ProjectLocker 门户中提交工单,我们可以查看您的项目并确保我们没有问题阻止您访问您的存储库。

      【讨论】:

        【解决方案4】:

        此外,请确保从您的 ProjectLocker 帐户本身将您自己添加到项目中。通过单击左侧窗格中的“列出帐户用户”来执行此操作,检查您是否被列为用户之一(可能是管理员?),然后单击“列出项目”,选择项目名称(不是编辑链接),在“项目中的用户”标题下,您应该会看到自己列出来。如果您不在那里,请将您的用户 ID 添加到您尝试与之同步的特定项目中,否则......不行。顺便说一句,这也是您控制谁可以访问项目的方式,即读/写权限。

        【讨论】:

          猜你喜欢
          • 2020-03-17
          • 1970-01-01
          • 2013-05-01
          • 2018-07-03
          • 2023-03-04
          • 1970-01-01
          • 2012-04-07
          • 2020-09-15
          • 2019-04-01
          相关资源
          最近更新 更多