How to move a remote egit repository? - egit

We're using the Groovy/Grails tool suite from Spring (similar to STS), version 3.1, and have an eGit remote repository on a shared network drive. That network drive is going away and we need to move it somewhere else. I have found instructions on how to move local repos, but not remote repos. Is there an easy way to accomplish this? I've also seen warnings against disconnecting the repository when searching for ways to do this as apparently re-importing became troublesome. I did try copying the repository to another location, deleting my project, and re-importing but the wizard still contained references to the old location (I think they were just default repository settings set within the tool suite) and I wasn't sure that this would be the best practice.
Being relatively new to git, and quite frankly not a huge fan yet, I'm unsure as to how to proceed. I see documentation on cloning and adding repos, but not how to move one. I've also put forth an argument for using gitHub but that won't happen before I need to do this. Thanks!

Related

GitHub + Eclipse Workflows

I am sure this is a RTFM thing, but after a few days of research I still cannot determine the correct (or best) workflow for this.
I have an Eclipse Workspace with a number of Java Projects in it and a number of C++/Arduino projects.
I want to start using GitHub as an online repository (easily reachable from outside my private LAN dev environment) for my projects
I was thinking I would like a separate C++/Arduino and Java GitHub repos. More could come for Python, PowerShell, etc. (But I will happily entertain other recommendations for repo structures).
Outside of the actual mechanics of using Egit, I cannot figure out the most appropriate workflow/folder structure for accomplishing this. Should I create local Git repos and push to GitHub as a remote? Should I use GitHub's web interface to import the entire Eclipse Workspace? Should I work directly with the Eclipse Workspace or have separate Git folders?
I guess the crux of my problem is that after reading a few related posts on this site I get conflicting advice about creating a local repo from the Eclipse workspace vs. a separate local repo. I think I need to understand this distinction first before I ultimately determine the best overall workflow.
I apologize for the broad nature of this question, but I hope that the community can help me narrow the workflow process design (or the question itself).
Two things up front:
Never put your entire workspace in source control; projects: yes, workspace: no. The .metadata folder contains data specific to that location and your machine, and that's ignoring any potential security risks with making it public.
eGit works with your git clones' own metadata, so if you're more comfortable doing certain things from the command line, go for it. I know I am, but I still appreciate the UI and decorations that eGit provides. Just make sure any automatic refresh/update preferences on the Workspace or Git preference pages are turned on.
You probably want the repository to contain multiple projects, rather than having a separate repository for each one. That way histories and changes that belong together are together. Nest the layout however you like, but remember that you're not constrained to a single repository for everything, either.
I don't know that there's a best practice for this, especially with projects that already exist, but projects should themselves be relocatable. My recommendation, after backing it all up:
Make the Github projects, clone their repos locally. I do it this way, from the command line, to save me any headaches with the history, remotes, and refs. I don't think you can modify the repository metadata in this method, though.
Move the workspace projects into the local clone. You can delete them from the workspace (be sure not to delete the underlying files), physically move the directories while outside of Eclipse, and then import them as projects back in from the Git Repositories View--unless they're Maven projects, in which case it's better to use M2E's import wizard.
Stage, commit, and push the projects up to the remote origin. For Java projects, don't forget to set the JRE System Library in the Java Build Path to use an Execution Environment. It's a simple bit of indirection that makes them more portable across machines.

Struggling with managing my eclipse workspace and what to do about syncing it between two machines

I'm trying to sync my workspace with PC<---->Laptop. PC is windows, the laptop is ubuntu Linux. Both have 5.1 Mars eclipse version.
So far I've been using dropbox to sync in between but problems started occurring but managed to solve them. I was compiling classes with a newer version of java and the other eclipse didn't know what to do. Syncing with dropbox is really not an elegant way of doing this.
So now I'm trying out git, but so far I've been confused by it and how it works. I have managed to set the git plugin in the eclipse but not sure what to do next. The plugin is called EGit.
As far as I understand so far, it works like this? workspace--->local repo---->git repo? Then I would have to manually sync the code back on my laptop by entering the commands in terminal?
I already did push some stuff to my private repository, but that was on my laptop.
Is it possible to setup an easy way to sync the code? I know git is a good versioning system and a good way to keep the code updated? I'm a first year CS student and so far I don't have any complicated or large projects to manage with. I'm just looking for a nice way to sync the code. I guess having git setup is an ok way to go about it, but I'm overwhelmed by the features of git and not really grasping it.
Thanks for reading.
It would be a good idea to learn how to do it right. It's a better investment of your time than working on workarounds which only work in a certain situation or which are of limited use. Yes, you could use git for that. You do not really need the EGit plugin, just use the git command line, in my opinion that is easier. There are a bunch of great git tutorials out there. For the beginning the basic commands like git init, clone, pull, status, diff, add, commit, push are sufficient. You would need a central git repository, get a free GitHub account for that purpose.
Compiled classes should not be commited into your source repository. Add folders with any generated files to your .gitignore file.

Windows Github issue pushing a new folder

I'm a VSS (Visual source safe) & Dropbox guy but new to GitHub. I'm using Windows Github tool to manage repositories on our remote server as I concluded in my previous SO post. I was glad to have sought this single point easy to use tool without any need for a deeper knowledge of git.
Things have been working fine until one day I had to add a new folder
to my repository. The Windows Github tool wouldn't recognize the
folder as a new content to be pushed! After some struggle I derived
that it "does" maintain sync with my "initial folders" but simply
creating a new folder in the repository directory wouldn't sync it
like Dropbox!
I searched to know how I can do it or if I had to use GitShell. My bad any I tried it, failed. Finally, I decided to purge everything and re-create the repository folder structure with this new folder like I did with my initial setup. But I don't know how or why it kept saying that the /.git/index file was being used by another process. I tried to empty this folder but it wouldn't. Finally, a logoff was able to free that file for me and I re-created everything. Pheew!
I might be doing it wrong as a newbie or even misusing Git due to my Dropbox habits. Pls correct me! What would be the best way?
My usage is more like VSS & dropbox(with version control) in a small remotely connected team. I started with this simple Windows Github tutorial. What about the following two -
TortoiseGit
msysgit
Do they provide better management? Pls suggest if Windows GitHub is the best (if so how to add folders later?)
Just in case, do note that adding a folder won't trigger anything for Git: you won't be able to push it if that folder is empty, because Git will consider it as "no content", and will ignore that new folder.
See also "How do I add an empty directory to a git repository?".
If you add a folder and some files in it, then the GitHub for Windows interface will detect that new content, and ask you to add and commit, which means you will be able to push.

How to setup SVN repository in XCode?

I have got to the point with developing iPhone apps that I need a way of managing versions. I have looked into the ways to do this through Xcode and I see that I can either go down the path of using GIT or SVN.
In the past I have used SVN which is the reason I'm more inclined to go down this path (I'm open to using GIT if people feel it is better than SVN). My question is related to the setup of a repository in Xcode.
I have done a fair amount of research and I have found several useful tutorials, however a lot of the seem to be outdated.
My question is 2-fold:
Please can someone advise on the steps to setup a repository through Xcode?
I notice Xcode requires me to set the location of the repository. I'm not sure what to do here, since I don't have my own server. Is there a way I can get around this? Can I setup a local repository somehow (if so how? if not what are my other options?)?
Thanks in advance for any help or advice people can offer.
I think you should go with using GIT. You can create free repository on bitbucket.org
It allows you to create free account which can be used using 5 members of your team. If you want more you need to pay.
Once you are done with creating repo. just check it out on your pc. There are steps given on that site how to do that. Then in the folder which you checked out, create your XCode project. Once your project is ready, add it to the repository. How to do that is also given on bitbucket. Then once you have committed your Xcode project to repository, add that repository to XCode. How to do that is very nicely explained in XCode guide. Just read that.
If you have a home server (or company server), I would use uberSVN. The guided installation is extremely simple. I actually use this to keep all of my Xcode projects under version control.
Steps:
Install an SVN client. (Bottom-right of the page. You can choose 1.6 or 1.7, and your OS via the tabs on the top of the page).
Install uberSVN.
Setting up one's own Subversion or Git server is something developers shouldn't have to fight with, it can be a pain (in terms of sys administration).
If it were me, I'd consider using GitHub if you want to share code publicly (free!) or if you want to share code privately among several of your own computers.
If you're sharing among your own computers, a "micro" account on GitHub runs $7 per month. This is the option I do for my own private & personal projects. So nice to have support built into Xcode.
There are also other third party providers that do both Subversion and Git, such as WebFaction, but this would also cost dollars as well. All of these services have to recoup the costs of doing your system administration. But I think having somebody else do it for you is well worth not having to deal with the hassle.
SVN requires you to use a server to host your repository on. If you're working on an open source project there are webservices that will allow you to host your repository for free (Google Code for instance). Although it's possible to have the server on the local machine, it's better to use GIT in that case. When you create a new project XCode will propose to setup a GIT repository for you, or see this on how to create a new repository for your existing project.
It's actually very easy to setup a local SVN repository on your Mac and reap the benefits of version control without remote/networked repository.
See e.g. explanation here https://stackoverflow.com/a/10039004/226086
Then the path you give Xcode is wherever you set up the repository, say file:///Users/Shared/subversion/ - under Preferences/Accounts/Add Repository, when it asks "Enter repository address".

Version Control for School Project

we will be doing a project for our Object Oriented Software Eng. class, and our team consists 4 people, including myself. Our groups were made random, so I do not know their level of skills. Maybe they have never heard of version control. I am looking for a system that will allow us to work together. I have used SVN and Git for a very little time. However, I am not very confident with them. Can you suggest a nice and easy to use system that is compatible with Eclipse or NetBeans IDE? Simplicity is the most important thing and I do not know how to use Git or SVN for a project more than one people. (I have only used them individually)
You need to have some kind of Source control.
If you have used SVN/GIT in your own projects using it in a team is just as easy. SVN is easiest, however even though it is a little harder I would go for mercurial with tortoiseHG, hosted for free at bitbucket.
It will Integrate into the windows UI
Its distributed which will make things smoother and reduce merge issues
You get free private hosting
You can use tortoise SVN or VSS (Visual source safe) to maintain project among multiple peoples. In both tool, you can maintain local copy of project in your PC and commit your changes on server when it completes.
Version control tools comparision : http://en.wikipedia.org/wiki/Comparison_of_revision_control_software
Have a look at Mercurial. It is easy to use and portable (it's written in Python). If you use Windows, you will probably find TortoiseHG useful too, as it provides Explorer extensions for mostly all functions Mercurial supports. There are also many sites that provide free project hosting for this VCS, such as BitBucket. And here is a nice tutorial about Mercurial.
EDIT: I once found a Mercurial plug-in for Eclipse. You can find it by searching in Help > Install Software in Eclipse.
I have used Dropbox as source control in a project once, it worked ok you can also revert to old version of your files which is great, we didn`t have to work in the same files so there was no conflict.
But now that I have gotten used to svn and mercurial I would never use something else. I too would recommend using mercurial with tortoiseHg and a bitbucket acount. I have started using it for smaller project as well, I simply did a repository with all of them in it so I have at least a backup and I am able to revert to an old version if need be.
My recommandation is to avoid sharing a folder using tools like dropbox and use a real source control like mercurial hosted on bitbucket (free for project with less than 4 users).
I'd say using SVN or GIT is a bit over kill for a school project which is likely to not last that long.
Another option would be to use something like DropBox.