First you have to disconnect the current repository. For this,use the command: git remote remove origin
Once that's done, you can link the new repository by running: git remote add origin https://github.com/UserName/repositoryName.git
Make sure to replace "YourUserName" with your actual GitHub username and "repositoryName" with the name of your repository.