DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on

How to update Bitbucket remote URL with username

If you have projects on your local that are connected to different bitbucket accounts, then you might need to set default identity and one of task is to update your project git remote URL.

To do so, go to your project root directory and type the following command:

git remote -v
Enter fullscreen mode Exit fullscreen mode

and you will see something like this:

origin git@bitbucket.org:foobar/hello.git (fetch)
origin git@bitbucket.org:foobar/hello.git (push)
Enter fullscreen mode Exit fullscreen mode

Now, to update/replace git@bitbucket.org with <username>@bitbucket.org use the following command:

git remote set-url origin <username>@bitbucket.org:foobar/hello.git
Enter fullscreen mode Exit fullscreen mode

and now if you type git remote -v you will see the following:

origin <username>@bitbucket.org:foobar/hello.git (fetch)
origin <username>@bitbucket.org:foobar/hello.git (push)
Enter fullscreen mode Exit fullscreen mode

Happy coding!

References:

Top comments (0)