Git - Syncing a Github repo with a local one?
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
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
What you need to do is clone your git repository. From terminal cd
to the directory you want the project in and do
git clone https://github.com/[username]/[repository].git
Remember not to use sudo
as you will mess up the remote permissions.
You then need to commit any changes locally, i.e your git commit -m
and then you can do.
git push
This will update the remote repository.
Lastly if you need to update your local project cd
to the required directory and then:
git pull