How do I move my repo to another computer?

  1. I just copied and pasted my repo folder to another computer. And of course it’s not a ‘repo’ now. How do I turn this folder into a repo in SourceTree?

  2. After copying the folder, something seems to have gone wrong as well. There are unexpected errors in the solution files. I tried opening the .sln on VS2019 which I used on the original PC ---- 27 errors.
    Then I tried it on VS2017 ---- 4 errors. Could someone tell me what is going on with my files? How should I fix it? Without having to build a brand new project?


  1. If you copy/paste the folder containing the .git folder (i.e. its parent), you should be copying your entire working space including your currently checked-out branch and any changes, plus your repository contents and history. For it to show in Source Tree you would need to “Add” it and select that parent folder that contains the .git one, but that’s not making it a git repo, just making the UI aware it should use it.

  2. I can’t be perfectly sure but there’s a likelihood you are missing some plugin and/or misplaced references (references that were at one path on one machine, but found at another path on the other machine). Have a look under both the References and see if any have issues, and under the Tools > Extensions and Updates menu to check that everything you need from the other machine is also showing up there.

If you did something else that might have been a bit different, what exactly did you copy across and/or what actions did you take?

1 Like
  1. If I understand you correctly you didn’t have an existing repo prior to moving it? If so then you would use “Create” in SourceTree. Otherwise read @topdog’s reply.
  2. You most likely just need to rebuild. Build > Rebuild.
1 Like

Personally, I like to copy projects as OP wants to just because it is a little better than syncing to me, but that leads into that you should be syncing it up to git and so feel that the slightly different approach of syncing the project down from github should also be considered here - you don’t have to copy/move but can sync instead.

1 Like

That would be my preference anyway (sync to git, then sync to another location), as it’s also a test of “am I capturing everything I should be capturing, in the event I suffer a loss” and making sure you can get back on your feet again ASAP from the repo contents alone (albeit maybe with a package update or rebuild like Dan recommends trying - those steps are sometimes unavoidable in addition).

Sometimes I even do that on the SAME machine to bring down a second copy of the project to test that out before I proceed any further.

  1. So I see. When I add the folder which directly contains the .gitignore file, it works. Now I can see the branches on SourceTree.

  2. I think I have moved all the references if they all are automatically put in one folder.
    (Quick question 1: how do I check the References though?)
    As you told me, I checked out the Updates and updated the Intellisense. And fortunately everything seems fine thereafter. Not a single error thrown out:)

Thank you @topdog @DanM . Extremely helpful and informative.

What does OP stand for?
And right! I didn’t even thinking of syncing at all. But how do I sync anything to my account on SourceTree? By adding the target repo in the Remote section I suppose?

LBNL, thanks for the reply.

Quick question 2: If the parent folder I added is not a git repo, are there any ways I can make it one?

Original Poster and Opening Post are two uses for OP in discussions :wink:

I don’t use SourceTree (I use a plugin for the Unreal Editor that syncs to github) so can’t answer that with exact steps. You can probably Google it or maybe one of the others will say something.

1 Like

In your solution is a References folder, if those references develop issues such as not being found where expected, they should show a small yellow triangle icon beside them

That won’t show until you expand it for some reason so just worth checking all is ok under there.

OP == original poster (I.e. you :D)

The account for sourcetree doesn’t itself have backend storage for using as a remote, but Github, bitbucket, and others too. Perhaps you’re using the same account for both sourcetree and bitbucket but wanted to signify the difference.

Syncing to a remote like bitbucket is then the easiest way you would pull (clone) the repo back down to another machine and/or folder.

Going to any folder and typing “git init” at a command prompt is sufficient to take a folder and start it as a repo, sourcetree’s Create option will do the same thing. This would NOT harm any existing content, although you should probably check and make sure there isn’t another git repo initialized along the same path higher or lower; nesting repos wouldn’t work well or as expected.

1 Like

I think I’ve got the ideas:) Let me try implementing them.

Your help is greatly appreciated. Very patient and thorough. It really motivates me to work harder.

Again I didn’t know there’s such a convenient plugin in Unreal. Got to look that up :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms