【Git】git将本地项目push到远程仓库失败?

【Git】git将本地项目push到远程仓库error?

1.问题

倘若直接命令:

$ git push origin remote_branch

#origin 为设置的远程仓库别名,remote_branch为远程分支名

会报错:

error: src refspec remote_branch does not match any
error: failed to push some refs to 'https://github.com/Adams-lm/
Club-activity.git'

2.解决

git提交本地分支远程分支有另外的格式,其正确形式如下:

$ git push <远程主机名> <本地分支名>:<远程分支名>

举个栗子:

$ git push origin local_branch:remote_branch

#origin 为设置的远程仓库别名,local_branch为本地分支名,remote_branch为远程分支名

你可能感兴趣的:(【Git】git将本地项目push到远程仓库失败?)