"git push"失败:"你没有指定任何refspecs推"

S. *_*els 2 git git-push

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

$ git push git-smichaels@free5.projectlocker.com:helloworld.git
Run Code Online (Sandbox Code Playgroud)

它会生成此错误:

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
Run Code Online (Sandbox Code Playgroud)

试图推动这种方式有什么问题吗?

我找到一个使用这种语法的人的例子:

git remote add myproject 'git-myloginname@projectlocker.com:myproj.git'
git push myproject +master:master 
Run Code Online (Sandbox Code Playgroud)

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

art*_*non 13

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

ERROR:gitosis.serve.main:Repository read access denied
Run Code Online (Sandbox Code Playgroud)

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

git push git-smichaels@free5.projectlocker.com:helloworld.git [branchname]
Run Code Online (Sandbox Code Playgroud)

如果你希望Git在没有警告的情况下指定[branchname]时推送当前分支,请执行以下操作:

git config push.default current
Run Code Online (Sandbox Code Playgroud)