Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Renaming a remote

    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 521
    Comment on it

    Rename the existing remote repository :

    There could be a condition where you want to add a new repository and you will get the message like repository already exist, or in other case when you mistakenly set the remote name wrong, then we need to rename the remote repository.

    Git provides the 'git remote rename ' command to reset the remote repository. Following is the syntax of renaming the remote repository:

    $ git remote rename oldname newname
    

    The git remote rename command takes two arguments:

    1. An existing remote name, for example, 'origin'
    2. A new name for the remote repo, for example, 'newname'

    For example :

    First we will check the old remote repository name which we will rename to new repository.Here we will clone the repository using the HTTPS.

    $ git remote -v
    # View existing remotes
    # origin  https://github.com/OWNER/MyRepository.git (fetch)
    # origin  https://github.com/OWNER/MyRepository .git (push)
    
    $ git remote rename origin destination
    # Change remote name from 'origin' to 'destination'
    
    $ git remote -v
    # Verify remote's new name
    # destination  https://github.com/OWNER/MyRepository .git (fetch)
    # destination  https://github.com/OWNER/MyRepository .git (push)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: