7 Fix Method 3: cloning



Test Image
Image credit: Pexels



If the previous fix methods don’t work or aren’t suitable, you can always start fresh by cloning a new version from the remote repository. This not only brings a clean version of your project but also eliminates any problems and conflicts that existed with the local Git repository.

7.1 Steps

  1. The first step is to go to the GitHub repository you want to clone. Navigate to the repository page on GitHub and click the “Code” button. Then select “HTTPS” and copy the URL to your clipboard.


Video. Copying the remote repository URL to clipboard in GitHub.



  1. Next, in RStudio, select “New Project” → “Version Control” → “Git”. Paste the URL you just copied into the “Repository URL” field, press your computer’s Tab key, and modify the folder name as desired. For example, you can add a “2” to the end of the original name to distinguish it from the problematic repository.


Video. Cloning the remote repository in RStudio.



7.2 Summary

Cloning a new repository is a reliable way to resolve issues related to conflicts between local and remote versions. This method ensures a clean starting point, allowing you to continue working on the project without previous technical obstacles. It’s particularly suitable for situations where local repository problems are difficult to fix and other methods, such as git reset, aren’t appropriate to use.



Divergent Git branches - from problem to solution © 2025 by Ville Langén is licensed under the CC BY-SA 4.0.

CC BY-SA 4.0