error pushing to a remote branch previously created

Marco Fumagalli

I'm not an expert in git.

I've a repo online with master. I created a dev branch using git checkout.

Now I want to commit some local changes just to dev branch.

So i did.

git add file

Then

git commit -m "Dag acquisizione"

I got message

C:\Users\marco.fumagalli\GAIMPORT\dev>git commit -m "Dag acquisizione"
[origin/dev (root-commit) 8ed7bd4] Dag acquisizione
 1 files changed, 236 insertions(+)

Which seems ok to me.

Then if I do

git push -u origin dev

I got an error:

error: src refspec dev does not match any. error: failed to push some refs to 'http://marco.fumagalli@****///*****.git'

padawin

You are currently on a branch named origin/dev, not dev. You probably created your branch with:

git checkout -b origin/dev

or something similar.

To fix it, first rename your branch to dev:

git checkout origin/dev # in case you are not on it already
git branch -m dev

then push it as you did:

git push -u origin dev

:+1: to you to use -u by the way.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Pushing mocks to remote wiremock server fails with "JSON Parsing" Error

Git pushing to remote branch

Track a new remote branch created on GitHub

Why git pull is not pulling the newly created branch that was pushed to remote?

Revert commit on remote branch without force pushing

WebStorm: Throwing error code 32708 when pushing Git branch

Git: Strange Behavior Pushing Local Branch to Remote Master?

Git reset hard throwing error on pushing changes to remote

Branch.io api update type. Make previously created link appear on quick links

Pushing feature branch to remote repository to merge with not in sync master

Pushing STS project from a local repo to a remote created by different user

Commit sub-directory in branch locally but do not include it when pushing to the remote branch?

Error when pushing to remote master branch on GitHub from VSCode

Libgit2sharp, Pushing a specific branch to new remote

Git created branch from wrong remote Branch

How to make a Pull Request using the new github cli, to a remote repo without pushing a remote branch too?

Git - Pushing local branch to remote and making local branch track that remote branch

How do I create remote branch for pushing to from my machine?

Pushing changes to a specific remote branch in Git

Pushing master to different remote branch netbeans GIT integration

Email address not allowed error when pushing to remote

Pushing to remote fails because "tip of your current branch is behind its remote counterpart"

How to see a remote branch, created with ADO, locally with a git command?

Resetting a remote branch without pushing the local branch

Pushing changes made in a local branch to a remote remote if the branch doesn’t exist in remote yet

Forgot to create a new branch before pushing to remote

Updating .git with newly created remote branch

git commit created locally. when pushing to remote, icannot push my local commit as the branch has updates waiting to be pulled

How to change Git remote answer when pushing a branch in Gitlab?