问题描述
我从主分支创建了一个功能分支,并向我的分支添加并提交了一些更改。
现在我想将我的工作推送到远程存储库,但失败了。我能做些什么来解决这个问题?感谢。
运行 git push
命令时,它并没有要求输入我的密码。这是正常的吗?
p.s。我使用的是Windows 10的cmd。
> git push origin my-branch
错误:src refspec my-branch不匹配任何。
错误:无法将一些文件推送到'https://git.xxx.net/Infrastructure'
> git commit -m我的工作
在分支my-branch
没有提交,工作树干净
> git分支
master
* my-branch
> GIT中显示-REF
687f22d54b89e0de91f16cf79d52c6ea21a3f562参/头/主
f85d2aa0900fb356d8d120f454ff2362d7475edb参/头/我的分支
687f22d54b89e0de91f16cf79d52c6ea21a3f562参/遥控器/来源/ HEAD
687f22d54b89e0de91f16cf79d52c6ea21a3f562参/遥控器/原点/ master
> git log
commit f85d2aa0900fb356d8d120f454ff2362d7475edb
作者:tim< [email protected]>
日期:星期五2月3日23:50:43 2017 -0500
我的工作
提交687f22d54b89e0de91f16cf79d52c6ea21a3f562
作者:Kevin< kevin @ xxx。 COM>
日期:1月19日星期四12:26:26 2017 -0500
新增gitignore
默认情况下,。
这意味着Git会尝试推送以本地名称命名的远程分支。
如果您没有任何远程该名称的分支,您需要明确说明您要创建并推送所述远程分支。
请参阅
通过添加 git按-u origin my-branch
,你会关联将iate分支到您的本地分支()
下一步将是一个简单的 git push
。
I created a feature branch from the master branch, and added and committed some change to my branch.
Now I want to push my work to the remote repository, but it failed. What can I do to solve the problem? Thanks.
When running git push
command, it didn't ask for my password. Is it normal?
p.s. I am using Windows 10's cmd.
> git push origin my-branch
error: src refspec my-branch does not match any.
error: failed to push some refs to 'https://git.xxx.net/Infrastructure'
>git commit -m "my work"
On branch my-branch
nothing to commit, working tree clean
>git branch
master
* my-branch
>git show-ref
687f22d54b89e0de91f16cf79d52c6ea21a3f562 refs/heads/master
f85d2aa0900fb356d8d120f454ff2362d7475edb refs/heads/my-branch
687f22d54b89e0de91f16cf79d52c6ea21a3f562 refs/remotes/origin/HEAD
687f22d54b89e0de91f16cf79d52c6ea21a3f562 refs/remotes/origin/master
>git log
commit f85d2aa0900fb356d8d120f454ff2362d7475edb
Author: tim <[email protected]>
Date: Fri Feb 3 23:50:43 2017 -0500
my work
commit 687f22d54b89e0de91f16cf79d52c6ea21a3f562
Author: Kevin <[email protected]>
Date: Thu Jan 19 12:26:26 2017 -0500
Added gitignore
By default, the push policy is simple (since Git 2.0).
That means Git tries to push to a remote branch named after the local one.
If you don't have any remote branch for that name, you need to explicitly state that you want to create and push said remote branch.
See "Why do I need to explicitly push a new branch?"
By adding git push -u origin my-branch
, you will associate to your local branch a remote (branch.<name>.remote
) and a destination (origin/mybranch
: branch.<name>.merge
)
The next push will be a simple git push
.
这篇关于错误:src refspec我的分支不匹配任何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!