Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 无法将文件推送到远程存储库_Git_Gitlab_Git Remote - Fatal编程技术网

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.