Wednesday, November 27, 2019

Git Bash | Changing a remote's URL | How to Change a Git Remote's URL | How Save Username/Password/Credentials For Git Repository in Git Bash

Got to the directory where the repository is located using Git Bash:

cd /path/to/repository
Run git remote to list the existing remotes and see their names and URLs:

git remote -v

The output will look something like this:

origin https://pritomkucse@bitbucket.org/pritomkucse/demo_project.git (fetch)
origin https://pritomkucse@bitbucket.org/pritomkucse/demo_project.git (push)
For example, to change the URL of the origin to some other repo you would type:

git remote set-url origin https://pritomkucse:your_password@bitbucket.org/pritomkucse/demo_project_2.git
Verify that the remote URL has changed using the same command git remote -v

No comments:

Post a Comment