我的计算机上有现有代码,然后我在sourceforge上注册了我的帐户,启动了一个git项目.现在我需要在sourceforge远程空间上发送我的本地项目.在sf上有指令页面:
第一次使用Git
cd miorep-code
git init
git commit -a -m 'Initial commit'
git remote add origin ssh://****/p/miorep/code
git push origin master
Run Code Online (Sandbox Code Playgroud)
现有存储库
cd miorep-code
git remote add origin ssh://****/p/miorep/code
git push origin master
Run Code Online (Sandbox Code Playgroud)
如果我遵循第一套说明,我有一个
"致命:带-a的路径没有意义"
当我得到git commit -a -m 'Initial commit'.
如果我遵循第二套指令,我得到:
错误:src refspec master与any不匹配.错误:无法将某些引用推送到'ssh:// **/p/ravenna/code'
当我执行最后一个命令.
在我的案例中,正确的说明是什么?为什么我会收到错误?
第一组指令没有意义:
cd miorep-code
git init
git commit -a -m 'Initial commit'
Run Code Online (Sandbox Code Playgroud)
需要有一个和git add之间,因为否则不知道你想要提交什么.你的第二个错误......git initgit commitgit
error: src refspec master does not match any. error: failed to push some refs to 'ssh://**/p/ravenna/code'
Run Code Online (Sandbox Code Playgroud)
...表示您尚未实际向本地存储库提交任何内容,因此没有master可推送的分支.
你想要做的是:
cd miorep-code
git init
git add .
git commit -m 'initial commit'
git push origin master
Run Code Online (Sandbox Code Playgroud)
你会注意到这几乎与你的第一组指令完全相同,除了我们添加一个git add .意味着"将我当前目录及其下的所有内容添加到我的存储库".