Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

The central repository had to be set up on a new server, so I created a new remote on my local repository and pushed to that.

But now when I do git pull, it claims I am up to date. It's wrong—it's telling me about the old remote branch, not the new one, which I know for a fact has new commits to fetch.

How do I change my local branch to track a different remote?

I can see this in the git config file but I don't want to mess things up.

[branch "master"]

    remote = oldserver

    merge = refs/heads/master

1 Answer

0 votes
by (27.5k points)

The following command should work: 

$ git remote set-url origin https://some_url/some_repo

Don't forget to push: 

$ git push

Related questions

Browse Categories