我在https://github.com/darKoram/sphero_tracker.git上使用我的GitHub帐户创建了一个远程仓库 .到目前为止它只包含一些维基页面,但我已准备好上传我的代码.
我用
git push origin git@github.com:/darkoram/shpero_tracker.git
Run Code Online (Sandbox Code Playgroud)
我也试过了
git push origin https://github.com/darKoram/sphero_tracker.git
Run Code Online (Sandbox Code Playgroud)
我得到的两次
refpspec的远程部分不是https://github.com/darKoram/sphero_tracker.git中的有效名称
我之前没有遇到过问题.只是不知道我在这里做错了什么.
我进一步了.按照马歇尔的说明和下面的generate-ssh-keys链接,但仍然可以获得
git push -u origin master ERROR:找不到存储库.致命:远程端意外挂断
我已经确定我的ssh密钥是好的并且验证它们存在于github上,通过将我的id_rsa.pub中的内容添加到我的github(它说密钥已经存在).
$ ssh -T git@github.com你好darKoram!您已成功通过身份验证,但GitHub不提供shell访问权限.
https://help.github.com/articles/generating-ssh-keys
ssh -T -p 443 git@ssh.github.com无法建立主机'[ssh.github.com]:443([207.97.227.248]:443)'的真实性.RSA密钥指纹是16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.您确定要继续连接(是/否)吗?是警告:永久性地将'[ssh.github.com]:443,[207.97.227.248]:443'(RSA)添加到已知主机列表中.嗨darKoram!您已成功通过身份验证,但GitHub不提供shell访问权限
git remote -v origin git@github.com:darKoram/shpero_tracker.git(fetch)origin git@github.com:darKoram/shpero_tracker.git(push)
And*_*all 12
git remote add origin git@github.com:darkoram/shpero_tracker.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
你发出的命令是"推送到名为origin分支的远程仓库git@github.com:/darkoram/shpero_tracker.git",这显然是不正确的.
小智 6
原始海报的原始问题说:
我用
Run Code Online (Sandbox Code Playgroud)git push origin git@github.com:/darkoram/shpero_tracker.git我也试过了
Run Code Online (Sandbox Code Playgroud)git push origin https://github.com/darKoram/sphero_tracker.git我得到的两次
refpspec的远程部分不是https://github.com/darKoram/sphero_tracker.git中的有效名称
该错误指的是您没有使用有效的refspec.refspec采用以下形式(项目[]是可选的,项目<>是参数):
[+]<source>[:<destination>]
Run Code Online (Sandbox Code Playgroud)
在上面的格式中,源和目标都是引用,Git中的分支是引用,因此您可以使用分支作为refspecs.例如,以下是有效和等效的refspecs:
master
master:master
Run Code Online (Sandbox Code Playgroud)
使用两个refspecs git push:
git push origin master
git push origin master:master
Run Code Online (Sandbox Code Playgroud)
将本地分支推master送到master远程上指定的分支origin.
你用过
git push origin git@github.com:/darkoram/shpero_tracker.git
Run Code Online (Sandbox Code Playgroud)
git@github.com:/darkoram/shpero_tracker.git不是vaid引用/分支,它是远程仓库的URL.这可能就是为什么Git抱怨refspec无效的原因.
推动分支的正确方法是
git push origin <branch>
Run Code Online (Sandbox Code Playgroud)
git push.