Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Github to access the same project files from different computers?

I work mainly on a desktop Mac but also have a laptop Mac that I use when away from the office.

I want to access and work on my latest html, css, php and python files from either computer.

I thought Github was the way to do this but am having a problem understanding the "flow" and I've RTFM! I don't understand whether I should create a Repository on Github first, why when I try to "clone" something it doesn't magically end up on my local computer... where the nice big red button that says "sync" is...

... or whether I should just use the commandline ONLY...

So, if I start on my desktop and create new files, what are the correct steps using git or Github (?) to put those files where they can then be accessed from my laptop and then have the files on my laptop merged back into the ?Github repository so I can then access those files from my desktop.

Thank you all for your replies and answers! The git workflow, for my needs, is now clear.

The workflow presented by wadesworld is concise and was the overview I needed.

However, Michael Durrant's commandline steps filled in that workflow specifically with commandline directives - and I needed that also.

steelclaw and uDaY's answers and responses were important because I did not understand that it did not matter which repo I created first and, adding and committing locally were essential first steps in my workflow.

Specifically, steelclaw's response to one of my response questions provided the closure I needed, so I could learn more:

After initializing the repository, be sure to use 'add' and 'commit.' These will make the files an official version of the repository. After that, you need to use 'push' to upload it to the remote repository."

ilollar's resource, "Git for Ages 4 and Up" is also worthy of the click, especially for folks like me who are visual!

Thank you all so very much!!

like image 385
Val Lynn Avatar asked Jun 10 '12 15:06

Val Lynn


People also ask

How do I share a GitHub project to another user?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", click Transfer. Read the information about transferring a repository, then type the name of the user or organization you'd like to transfer ownership of the repository to.

Can I use GitHub for file sharing?

It takes few easy steps to turn your Github into a file repository. You can upload files from the browser and you can add collaborators so they can also upload files to a common repository (similar to shared folders in Google Drive). The files are public so anyone can download them with a direct link.


2 Answers

Do you want to version control your files or just have access to the same files in both places?

It is a good idea to use version control as a developer, whether you're writing code or designing websites. But, to do so, you have to have a commitment to learning how version control systems work, since they all have some learning curve.

But, if you're not interested in that complexity and simply want to be sure you have access to the latest version of your files, then you're looking at a file syncing operation which can be much more simple.

So, which one do you want?

Edit: Based on the response, here's the model:

1) Create repository on work computer.

2) Create repository with same name on github.

3) Push to repository on github

4) At home, do a git clone to pull down the changes you pushed.

5) Now that the repository exists in both locations, you can simply do a git push before you leave work, and git pull when you get home, and vice-versa when going the other direction.

like image 79
wadesworld Avatar answered Oct 06 '22 18:10

wadesworld


To answer the detail of your question: I'd go with Dropbox.
UbuntuOne is also good even for non Ubuntu users and of course Google drive is the (big) new player on the block.

They compare as follows:

Service    Free*1  NextLevel*1  NextLevel($)*2  Features
Dropbox    2       50           $2.5O           One Folder, best gui sync tools.
UbuntuOne  5       20           $4.00           Multiple directories anywhere
GDrive     5       25           $2.50           It's Google.

*1 GB
*2 Cost per month

To answer the title of your question:

If you wanted something that's more suited to programmers, I'd use git:

First, install gitx (linux readers, that's gitg) as that is by far the most popular gui for git:

enter image description here

For the "flow" I can also refer you to my write-up of various features at:
What are the core concepts of git, github, fork & branch. How does git compare to SVN?

Using gitx or gitg the specific flow is as follow:

1) Make some changes to files.

2) Use the tools "commit" tab to see what's changed ("unstaged"): enter image description here

3) Add a file by dragging it from "unstaged" to "staged":

4) Give a commit message enter image description here

5) Commit the file. enter image description here

6) I then push it to the remote at the command line with $ git push remote or I use the gui by right clicking and select ing the 2nd master - see here: enter image description here

.

If I'm sharing with others I'll often need to do git pull to get ands merge in others chnages) before being able to do a git push

The github part is doing init and push and clone but I'd say just read up on those tutorials more rather than an SO question. Basically though, I do:

  • Set up repository locally in git:

git init
git add .
git commit "Initial commit"

Set up github:

Create a github repository using github (https://help.github.com/articles/create-a-repo)and then push your local repository to it as in:

git push origin master.

If the repository already exists on github but not on your local pc, that's wheh you click the remote link and then in a terminal type git clone [paste here, e.g. ctrl-v]

If you're "starting" with github:

  • Make code changes
  • git pull - get latest version into your repository and merge in any changes
  • git add . Add all modified files
  • git commit -m "message"
  • git push # origin master is the default.

If, at the end of the day you decide to go with something simple like Dropbox you can use my referral link -http://db.tt/pZrz4t3k- to get a little more than the standard 2GB, Using this we both get an extra 0.5 GB, however which of all these routes to go is up to you and your needs. I use all these services (git, github, UbuntuOne, Dropbox and googleDrive, so I am not recommending one over the others -it depends on the needs).

like image 29
Michael Durrant Avatar answered Oct 06 '22 16:10

Michael Durrant