VSTS: Error encountered while pushing to the remote repository: Not a valid reference 'origin/development'

19,106

Solution 1

Try right-click on my local branch in Visual Studio under "Branches" in Team Explorer and do a Push, this is where it fails. If I go to "Sync" and do a Push under Outgoing Commits, it works fine.

Solution 2

The same thing happened to me and I resolved it by going to my Repository Settings in Team Explorer > Settings and updating the settings under "Remotes". Origin was set incorrectly to a local git instance.

Share:
19,106
mal-wan
Author by

mal-wan

Data Guy

Updated on July 19, 2022

Comments

  • mal-wan
    mal-wan almost 2 years

    Edit - This issue seems to have (at least temporarily) resolved itself - I have no idea why and I have not changed anything to make it work - I'll update if it breaks again

    I used Git-TF (https://gittf.codeplex.com/) to move our existing Team Foundation Version Control repo to a new Git repo (both repos in the same VSTS Project).

    It all appeared to work correctly. However now we have lots of issues.

    • Trying to push changes from a local branch to a remote branch gets the following error:

    Error encountered while pushing to the remote repository: Not a valid reference 'origin/development'

    • Using the Sync command, however, does work and pushes changes successfully to remote.
    • Perhaps the biggest problem - we've only be able to get a Pull Request to work once. Now every Pull Request is throwing 405 error for everything we try to do (abandon / accept - it all throws the same 405 Error)

    enter image description here

    Edit: Steps Taken to setup the Git repo

    1. Downloaded and installed Git and Git-tf on my local machine
    2. Cloned the TFVC repo locally via git-tf
    3. Created a new Git Repo via VSTS
    4. Set the new repo as remote on my local machine
    5. Pushed the full history to the Git Repo

    Steps taken once the Git repo was established

    1. Created a development branch from the master
    2. Checked the development branch out locally via Vis Studio
    3. Created a new local branch from the local development branch
    4. Made changes and a few commits
    5. Publish the local branch to remotes
    6. Click on "Create a Pull Request" from Vis Studio
    7. Local Source Branch: test-branch, Remote target: development - then click Create
    8. No Merge Conflicts, I review my own work and Accept - so far so good
    9. Click on Complete Pull Request, leave "delete branch after merge" selected and click Complete Merge
    10. And this time it's worked...infuriatingly... The last 2 days it hasn't worked...

    Back to square one until I can repeat the process it seems.

  • ahjashish
    ahjashish over 4 years
    Still having this issue. Wonder if they'll ever fix it.