Please take a backup of your existing code before you try any of these steps out. I am not responsible for any loss to your work.
Before you start performing these steps, please make sure you have Git installed on your machine.
Test for Git Installation1. Open command prompt and type
If you do not see an output like the following line, you may not have Git installed
usage: git [--version] [--exec-path[=
To install Git on your local machine please see the instructions here.
Open an Account at BitBucket or GitHubOpen an account and create your repository called "mygrailsproject" in BitBucket, GitHub or a similar service.
Using the Git Repository1. Go to the root folder for Grails project
2. Make the .gitignore file for Grails project
> grails integrate-with --git
3. Create an empty git repository at the project root
> git init
4. Optional: If you are using the STS (Eclipse IDE) please add this line to the created .gitignore /target-eclipse/
5. Add the gitignore file to the repository
> git add .gitignore
6. Commit the .gitignore as the first commit
> git commit -m "Added the gitignore file"
7. Now see the status of the local repository
> git status
8. Do a trial run to see that everything you are going to add to the repository is correct
> git add -n .
9. If everything looks good perform the real git add
> git add .
10. Now commit the code locally
> git commit -m "First version of the Grails software added"
11. Add the Git origin (you should have created your repository in BitBucket, GitHub or a similar service by now)
> git remote add origin ssh://email@example.com/youraccount/mygrailsproject.git
> git remote add origin https://firstname.lastname@example.org/accountname/mygrailsproject.git
> git push -u origin master