github - a n00bz guide

Out of context: Reply #12

  • Started
  • Last post
  • 12 Responses
  • section_0142

    ok, my time to shine.

    First, do you have a github account? Sign up / log in before you do anything. Then, you need to link your computer to your account. This is done by the way of SSH keys.

    On a Mac (idk about Windows), open up a terminal and type:

    ssh-keygen -t ed25519 -C

    Just say yes to everything, and use whatever defaults it gives you. Saving in ~/.ssh is the most common thing to do.

    Use the same email you signed up to Github with. Next, copy the contents of: ~/.ssh/id_ed25519.pub on your system and navigate over to https://github.com/settings/keys…, and click "New SSH key".

    Paste what you copied from id_ed25519.pub in there, and save it. Restart your terminal, and you're good to go. All linked up.

    ------------------

    Now, if you want to get that code on your system, you can do it the right way (downloading a zip is the wrong way). Go to that repo, click the big green "Code" button, and copy the url out of the "SSH" block.

    Go into your terminal and type:

    git clone git@github.com:some-repo/some-re...

    Bam, you have the code now. Now, you can do things like "git pull" which will pull down the latest changes from that repo. Or, alternatively "git fetch" to review the changes first, and then "git merge" to merge them in.

    -------------------

    Finally, since pull requests were mentioned, here's how you handle those. If you intend on contributing to this project, you can't really do that directly.

    Instead of cloning that repo directly, you want to create your own "fork" first. So, go back to that repo page, and look at the top-right part of the page. There's a "fork" button. Click that, and follow the prompts.

    Now you have your own repo which points back to the original repo. The base repo you based your fork off of is what git refers to as "upstream".

    Just like before, type:

    git clone git@github.com:your-forked-repo...

    But, use the address that is under your username.

    Now, if you make some cool new feature, you can make a pull request on the main project that points to a branch on your forked repo (I know this is confusing, lol).

    Finally, make heavy use of branches. Never ever work of the master (or main) branch. As soon as you clone this type:

    git checkout -b some-new-branch

    That way if things fuck up, you can just type:

    git branch -D

    to delete the branch. You can't delete a branch that's currently checked out, so switch to something else before running that. This is how you switch branches:

    git checkout branch-name

    And here's how you list them:

    git branch

    Okay, that's enough for today!

    • after -C on the ssh-keygen part, should be "youremail@whatever... idk why QBN cut it off.section_014
    • lol this is great, going from generating ssh keys to branch checkout you're definitely not going to loose your shit in a matter of seconds :Dsted
    • Just gotta take it one step at time! ( :section_014
    • WOW, well thanks. i'm not sure i'm much the wiser - probably best to follow my instinct and stay well clear, as sted recommends.hans_glib
    • once a noob always a noobhans_glib

View thread