Thicket data repository for the EEG
at main 3.4 kB view raw
1{ 2 "id": "https://www.tunbury.org/2020/02/25/how-to-github", 3 "title": "How To GitHub", 4 "link": "https://www.tunbury.org/2020/02/25/how-to-github/", 5 "updated": "2020-02-25T12:41:29", 6 "published": "2020-02-25T12:41:29", 7 "summary": "I really don’t use GitHub often enough to remember the commands without searching for them each time, which means that I use GitHub even less as I can’t remember the commands. Here’s a short cheat sheet on the most common things I need to do in GitHub.", 8 "content": "<p>I really don’t use GitHub often enough to remember the commands without searching for them each time, which means that I use GitHub even less as I can’t remember the commands. Here’s a short cheat sheet on the most common things I need to do in GitHub.</p>\n\n<p>Navigate to your project folder then create a repository for that directory</p>\n\n<div><div><pre><code>git init\n</code></pre></div></div>\n\n<p>Add all the files in the current directory to the Git index. Of course you can be more selective here and iteratively add files one at a time</p>\n\n<div><div><pre><code>git add .\n</code></pre></div></div>\n\n<p>The current status can be checked at any time using</p>\n\n<div><div><pre><code>git status\n</code></pre></div></div>\n\n<p>Now commit the files in their current state to the repository with whatever comment is appropriate</p>\n\n<div><div><pre><code>git commit -m \"Initial commit\"\n</code></pre></div></div>\n\n<p>You may well be problem to set your global username and email if you’ve not done it before:</p>\n\n<div><div><pre><code>git config --global user.email \"you@yourdomain.com\"\ngit config --global user.name \"Your Name\"\n</code></pre></div></div>\n\n<p>At some time later after you have made changes you need to add the changed files again and commit or do a combined add/commit like this</p>\n\n<div><div><pre><code>git commit -a -m \"great new code added\"\n</code></pre></div></div>\n\n<p>To see the current changes compared to the repository</p>\n\n<div><div><pre><code>git diff\n</code></pre></div></div>\n\n<p>And finally if things went south you can commit the current state and then revert to the last commit point</p>\n\n<div><div><pre><code>git commit -a -m \"Oops\"\ngit revert HEAD --no-edit\n</code></pre></div></div>\n\n<h1>Working Online</h1>\n\n<p>That’s all very well and I could continue to work like that but I want to keep a copy at GitHub so create an RSA key for authentication</p>\n\n<div><div><pre><code>ssh-keygen -t rsa -b 4096 -C \"you@yourdomain.com\"\n</code></pre></div></div>\n\n<p>Add this key to your SSH Agent</p>\n\n<div><div><pre><code>ssh-add ~/.ssh/id_rsa\n</code></pre></div></div>\n\n<p>Sign in to GitHub and copy and paste the public key into the SSH and GPG Keys section</p>\n\n<div><div><pre><code>cat ~/.ssh/id_rsa.pub\n</code></pre></div></div>\n\n<p>Create an empty repository on the website. Note the SSH address and add it as a remote repository on your local system</p>\n\n<div><div><pre><code>git remote add origin git@github.com:username/project.git\n</code></pre></div></div>\n\n<p>And then push your local copy to GitHub</p>\n\n<div><div><pre><code>git push -u origin master\n</code></pre></div></div>", 9 "content_type": "html", 10 "author": { 11 "name": "Mark Elvers", 12 "email": "mark.elvers@tunbury.org", 13 "uri": null 14 }, 15 "categories": [ 16 "juniper" 17 ], 18 "source": "https://www.tunbury.org/atom.xml" 19}