我使用以下内容克隆存储库:

git clone ssh://xxxxx/xx.git 

但在我更改一些文件并添加和提交它们之后,我想将它们推送到服务器:

git add xxx.php
git commit -m "TEST"
git push origin master

但我得到的错误是:

error: src refspec master does not match any.  
error: failed to push some refs to 'ssh://xxxxx.com/project.git'

当前回答

首先,gitadd。第二,gitcommit-m“message”第三,git推送原点分支

请检查拼写错误,因为这也可能导致错误。

其他回答

要检查当前状态,请使用gitstatus。

并遵循以下步骤:

git init
git add .
git commit -m "message"
git remote add origin "github.com/your_repo.git"
git push -u origin master
git init
git add .
git commit -m "message"
prompt me to enter email and user name
  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

输入上述详细信息后,文件将提交并成功推送:

git push

最初,每个文件都处于未跟踪状态。我们需要将未跟踪的文件从工作目录添加到暂存区,只有这样Git才能开始跟踪这些文件。从工作目录中,我们将文件移动到准备好进行下一次提交的暂存区,这样Git就可以对它们进行快照以创建新版本。您跳过了临时区域,只向临时区域添加了一个文件。

首先转到要推送的本地文件夹,然后执行以下步骤。

初始化

git添加。

gitcommit-m“首次提交”

我认为问题源于添加和提交node_modules文件夹。

使用git add.时。,您可能会得到无限滚动,就像它添加了几个文件一样。如果是这样,您不仅要添加脚本,还要添加大小较大的node_modules文件夹。

最好的解决方案是创建一个.gitignore文件,在其中粘贴#dependencies/node_modules。

现在,当您添加文件时,Git将忽略node_modules文件夹。

可能是您当前的分支没有上游分支。当你要第一次按下时,请尝试这些命令。

git init
git add .
git status
git commit -m "initial commit"
git remote add origin "github.com/your_repo.git"
git push --set-upstream origin master