Git 无法将文件推送到远程存储库
我为一个项目克隆了一个空的Git 无法将文件推送到远程存储库,git,gitlab,git-remote,Git,Gitlab,Git Remote,我为一个项目克隆了一个空的repo,但无法将文件推送到远程(第一次推送) 我可以确认已成功添加我的ssh公钥: ssh -T git@gitlab.com Welcome to GilLab, @username! 但无法推送文件: git push README.md fatal: invalid gitfile format: README.md fatal: Could not read from remote repository. Please make sure you have
repo
,但无法将文件推送到远程(第一次推送)
我可以确认已成功添加我的ssh
公钥:
ssh -T git@gitlab.com
Welcome to GilLab, @username!
但无法推送文件:
git push README.md
fatal: invalid gitfile format: README.md
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这里缺少什么?您不能将文件推送到远程分支<代码>git推送在分支上操作 这里有一个简单的工作流程
#修改README.md文件或任何其他文件
#添加它并进行提交
git add REAME.md
git提交-m“更新自述”
#将分支推送到远程,用真实的回购名称替换“”
git推送
#或
git推送:
#乙二醇
git推送源主机
顺便说一句,在这种情况下,ssh公钥将不会在git push中使用。原因“远程”分支
origin
使用的是https
协议,而不是git
协议。什么是“推送文件”?这根本不是它的工作原理。你能在答案中添加详细信息吗?@arilwan你不能将文件推送到远程分支<代码>git推送在分支上操作。请用谷歌搜索一个git
教程。这是git
@arilwan更新了我的答案中非常基本的概念。现在已经足够详细了。
git push README.md
fatal: invalid gitfile format: README.md
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.