Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Syncing a Github repo with a local one?

Tags:

git

linux

github

First off, forgive me if this is a duplicate question. I don't know anything but the basic terminology, and it's difficult to find an answer just using laymen's terms.

I made a project, and I made a repository on Github. I've been able to work with that and upload stuff to it for some time, on Windows. The Github Windows application is nice, but I wish there was a GUI for the Linux git.

I want to be able to download the source for this project, and be able to edit it on my Linux machine, and be able to do git commit -m 'durrhurr' and have it upload it to the master repository.

like image 672
Keith Gadberry Avatar asked Oct 23 '12 17:10

Keith Gadberry


2 Answers

Forgive me if you've already done most of this:

The first step is to set up your ssh keys if you are trying to go through ssh, if you are going through https you can skip this step. Detailed instructions are provided at https://help.github.com/articles/generating-ssh-keys

The next step is to make a local clone of the repository. Using the command line it will be git clone <url> The url you should be able to find on your github page.

After that you should be able to commit and push over the command line using git commit -am "commit message" and git push

like image 171
Eric Y Avatar answered Oct 16 '22 20:10

Eric Y


You can use SmartGit for a GUI for git on Linux: http://www.syntevo.com/smartgit/index.html

But learning git first on the command line is generally a good idea:

Below are some basic examples assuming you are only working from the master branch:

Example for starting a local repo based on what you have from github:

git clone https://github.com/sampson-chen/sack.git

To see the status of the repo, do:

git status

Example for syncing your local repo to more recent changes on github:

git pull

Example for adding new or modified files to a "stage" for commit

git add /path/file1 /path/file2

Think of the stage as the files that you explicitly tell git to keep track of for revision control. git will see the all the files in the repo (and changes to tracked files), but it will only do work on the files that you add to a stage to be committed.

Example for committing the files in your "stage"

git commit

Example for pushing your local repo (whatever you have committed to your local repo) to github

git push
like image 11
sampson-chen Avatar answered Oct 16 '22 19:10

sampson-chen