Github - melisakman/Helianthus GitHub Wiki

It is a very good practice to use git for backing up your scripts, synching with your local computer and version control. For this, you first need to have a github account. You can request an academic one with unlimited private repositories. Github can be used like dropbox to synch folders between computers/servers and this si exactly how I use it. I create my scripts on my local computer, synch this with github account and then synch it on the server to have those scripts.

Now open github and create a repository. Then go to that repository and copy the link from the green section on the right that says "clone or download". It should look like this: https://github.com/YourGithubUserName/YourRepository.git And now go to the folder that you want to store your scripts and do

$ git clone https://github.com/YourGithubUserName/YourRepository.git

Let's talk about how git works. First make an empty file on this rep on your local computer:

$ cd YourRepository

$ touch testFile #this will create an empty file

$ git add -A #this adds all files to commit on github

$ git commit -m "your version message" #commits your changes

$ git push #pushes your changes to github repository`

Now if you go to github site you should see this testFile there. Now ssh to the server to your local folder on /global/home/users/UserName. Create a folder called git (or bananas if you please), cd to that folder and again git clone your rep.

$ mkdir bananas

$ cd bananas

$ git clone https://github.com/YourGithubUserName/YourRepository.git

This will make a copy of your rep. One thing to keep in mind is to make sure that you do not make changes on your server and local computer before you commit one. If you change something on the server and not commit and push and then change something else on your local computer, you will create 2 branches when you push. And that will need some more advance git skill to fix it. So stay on the simple side and just do 1 change at a time.