Hi, how do I connect an existing Github repository to an existing R project? Suppose I have an R project already created with 2 scripts and 1 a database and also a Github repository with a script. How do I connect them and be able to have the 3 scripts and the database on both sides? But without having to create anything, since all the ways I found are creating either a repository or a new project.
As far as I know you can't make git to track a separate project, you need to gather all files into a single repository, then, if you need to have the repository on multiple locations you can clone it as many times as you need.
If you already have a github synced folder I think it's easier to move your files there, initialize an RStudio project and push changes to github, then you can clone the project in the other location.
From what I saw it can only be done in two ways:
- With an already created project, when connecting it with GitHub it will automatically create a new repository, but this way doesn't convince me because I can't choose the name of the repository and I would have to pass files from another repository to this one.
- With a repository already created, when I connect it to Git it will create a new project automatically. I'm not convinced because I would have to move all the files from the existing project to this one.
It's strange that there isn't a way to do this as I guess it's a fairly common problem. If I have a project and a repository created and I add a new computer with its own files to the "loop" there is no efficient way to do it.
I think what you are trying to do (or at least the way you are trying to do it) it's not an intended use for a "version control" system, although, I might be misunderstanding your request.
If you want to add another computer to the "loop" they would need to clone the centralized repository and then add their contributions to it by using pull request or pushing changes. Github is not meant to be used as a synced folder.
Yes, that seems to me to be the problem. I'm wanting to use Git in some way as a synced folder, since I'm trying to implement a system to have my files synchronized on all the computers I work on and Git is pretty close to that concept.
So far I haven't found a better way. I think I'm going to end up using the system of creating a new project for each repository I have and then move the files I want to have to the project folder (the second way I mentioned before).
Likewise, I find it strange that if I already have a repository created in Github and a project created on my computer there is no way to connect both "systems" without having to create a new folder/repository and then move the files.
You can initialize git in the project and add a remote source (pointing to an existing github repository) but you would need to solve any conflict that arises when committing changes. That doesn't sound like fun to me but I'm no git expert
Thanks, how do you synchronize files across multiple computers?
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.