Sunday, September 28, 2014

Very Short Guide to get Git Started by Beginner

Git is powerful and yet overwhelming at the beginning. I've been trying to learn it, and get stuck multiple times. This guide is for future me who might forget about this.

1. Create a github account on github. Create a repository name "ABC". This is simple enough as signing up for any website.
2. In any folder in your local computer that you want to sync with repository "ABC". Type (in terminal):
git init
# This will initialize a local git repository

3. Linking Local Repository and Remote Repository using SSH
Follow this giuide https://help.github.com/articles/generating-ssh-keys

4. Clone github "ABC" repository down to local git repository just created.
git clone xxx
# For xxx is the SSH Clone URL obtained from Github for "ABC" repository

5. Add file to local repository, and push to github

git add filename.ext
# This will add a file filename.ext to the local git repository
git commit -m "Initial Commit"
# This will commit this change made from add to local git repo, with a message "Initial Commit"
git push
# This will upload the local git repository to github

Done.

In case one have an existing local repository. Now one wants to connect that to a new git repository. Then follow https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line

No comments:

Post a Comment