 So one of the things that has made my life easier over the years as a desktop linux user is get and services like get lab and github because that's what I use to back up all of my dot files all of my config files That's what I use to back up all of my suckless builds things like my build of the surf browser and d-menu and things like that I just push all that stuff to my get lab and it's there. I never have to worry about losing it You know, I never have to worry about what if the hard drive fills in this computer, you know What if some catastrophe happens? I don't have a local backup. It doesn't matter It's all on my get lab and it makes distro hopping so much easier Those of you that distro hop a lot now I don't distro hop much these days But those of you that distro hop every few days if you are not using get to store all of your config files You have no idea how much of a headache you are causing yourself by not using something like get and get lab So today I wanted to show you my Usage as far as get and get lab, you know, I have some pretty basic needs But I do have several Repositories over on get lab and I will show you how to get started and I think you guys will find that it's Much easier to get into get than some people make it out to be I think a lot of people put learning get off for a long time because they think well It seems complicated when you watch people do it It's all command line stuff and you know some of the commands may not make sense to a new user You don't really know what's going on and it can seem scary, but it's really not I promise you after watching this video you guys can have your own get lab Repository setup and you can start backing up your dot files today So the first thing you probably want to do is just go ahead and sign up over at get lab So if you don't have an account over at get lab sign up once you have an account Such as my account here. You see personal projects. These are all the repositories that I have created Well, these are 10 repositories that I've created I've got a few more than that if I go to Projects and go to your projects it will actually list out all the repositories I have over on get lab now when you sign up after you've got your account What you want to do is you want to create a new project basically? This is a new repository and this repository. I'm going to call it test Yeah, we'll just call it test and the project slug which is the url So your url, of course will be get lab comm slash whatever username you created slash and then the project slug test It's fine. You need to create a project description. I'm gonna say this is a test for my video All right, and then what is the visibility level? Do we want it to be a private repository? Meaning nobody can see it But me do we want it to be public so everybody can access it unless you have a real need for it to be private? Most people probably are creating public repositories. Typically you want to create a private repository if you're You shouldn't be doing this anyway because it's a moral but if you were creating proprietary software closed source software You didn't want to share with the public or maybe you had some sensitive information But most people that are working on open source projects, of course are doing everything out in the open in public repositories Now you can also tick on this box as well initialize the repository with a read me So any repository you create if you ever create a read me It needs to be read me all caps dot md for a markdown file or read me all caps dot org for an org file And if you want it to go ahead and just create one for you You can take that box on and later you can go back and edit that read me and then let's create that project And that is it and then it immediately takes us to the test repository I just created there is a read me file, but there's nothing in it It's just the title and the description and we can actually edit this repository if we want now Let me pull up a terminal So let's open up a terminal to run some get commands Let's start learning the basics of running get at the command line The first thing we want to do is we created that new test repository over on get lab We need to clone it to our local machine And what you could do is go to the clone tab here and get the URL Just copy that URL then go back to your terminal and then type the command get Clone and then the URL of the repository we want to clone and in my case It's that test repository and then it clones it meaning that Wherever we were in the directory structure. I was in my home directory. There should be a test Directory there now because that is what we just did we clone that directory I can CD into test and when I do a LS you see it's still just an empty directory It has that read me dot markdown still there, but nothing else We haven't added anything else to this repository We could edit that read me dot markdown so I could do a vim Read me dot markdown or nano or emacs or if you wanted to you could open up in a graphical text editor like g editor Kate whatever you want to do I could add another line such as this is another and if I can type line of text and Then let me write that and quit and then now that we've modified that read me dot markdown We need to push it back to our get lab right We've changed it so we need to push it to that remote repository over on get lab So to add something what you need to run the command get add and then the name of file Yeah, add read me dot markdown in this case Now what you could do if there were several things in this repository several files and you modified Half a dozen of them or however many instead of having to add each one by file name You could do I get add space dash you meaning get add all the files that have been modified or updated And that's what I'm gonna do. So I did get add dash you and then if I run get status It's gonna give me the status of this repository and it's gonna say that I have one modified file Meaning that's one file that needs to be pushed to get lab, right? Even though I added it. It's in a staging area. It's really not on get lab yet. It's really not moved anywhere It's just something that we could do something with at this point So to take this to the next step what I need to do is I need to commit it. So I need to get commit dash M for message and then write a message, you know, what you modified in this file That needs to be something rather short but descriptive for people if other people are using your repository other people are pushing to it It helps them know exactly what kind of changes you made to that document. So get commit dash M I'm gonna put added another line All right Then hit enter and it says one file changed three insertions one deletion So it's just telling you a little bit about how you modified the file since the last push and then you actually need to push The file to your repository. So I'm gonna do a git push And it's gonna ask me my username over on git lab So DWT one is my username. Of course, you're gonna have a different username. It's gonna ask for my password So let me open up my password manager here and get my password And I will show you guys how to avoid using these passwords here in just a second All right, and that's it. We just pushed that to git lab now all I need to do Let's go back to the browser and let's just make sure our push worked and there is test We have two lines of text now You could have a million documents in this repository this test repository or any repository But by default the document it always shows is the read me file So if you have a read me dot md or a read me dot org in a repository That is always the document that it shows as a preview in your repository Another very important file that you probably should include in every repository is a license file And that is license all caps and if I wanted to I could do add license Just click it in git lab. You could of course Create it yourself on your local machine just open up your text editor and write a license and then push it But it's so much easier on git lab itself because you just hit the add license button and tell it What license do you want to license this under is there templates? Yeah So if I wanted to license a license it under Apache or MIT or the GPL or whatever I'll just choose GPL there. We've got a copy of the GPL and then all I need to do is scroll down now We could add a commit message. There's a default commit message here add license. That's good enough I don't know why you would need to do anything more than that then commit changes And that basically does everything that we would have done in a terminal It just does it on git lab now most of the time you're not going to want to be doing this kind of stuff on the git lab Website it makes sense for the license because it's so straightforward But most things you're going to do on your local machine and then after you do them on your local machine change whatever files You're changing you're going to open up a terminal. You're going to do a git add name a file Get commit dash M then the message and then a git push to push it to your git lab Let me go back to the main page of this test repository here And now you see we have two files in this repository We have the readme.md and we have the license I'm going to go back to the terminal and what I'm going to do is I'm going to open up a new document in vm I'll create a new document. We're all called this doc One dot md. We'll make it a markdown file and I'll just start typing something. So this is some gibberish Exclamation point. That's good enough for now. Let's write and quit by doing LS You see now we have doc one and we have the read me There's also the license file on the remote repository. We may eventually want to pull that down Matter of fact, let's go ahead just to make our repositories completely synced. So they have the same stuff Let's do a git pull. So if I do git pull instead of git push So when you do a push you or anything that you have in the staging area anything you've committed Goes to the git lab repository when you do a git pull anything on the git lab repository That is different from what you have locally gets pulled to your machine. I hope that makes sense. So let's do a git pull And let's do an LS and now you see now I have the license on my local machine, but now doc zero one is on the local machine But it is not on the remote machine yet So let's do a git add and I could do dash you for any file that's been updated, but that's not going to work here I'll try it but Get status There's nothing here because get add dash you is just for files that we've pushed to get lab before That get lab knows about and that have been updated. We've never done anything with doc zero one here So this time we actually do need to do git add and then the name of the fall Hit enter and now when I run a git status See new fall doc zero one dot MD and then we need to commit it So git commit dash M and then the name of your message adding doc O one dot MD will be my message and then finally you need to do a git push Again, it's going to ask for your username and it's going to ask for your password All right, and we have pushed doc zero one if I go back to the browser to the get lab test repository and Refresh you see that fall is now actually there we could review it now Imagine we've had this test repository going for a while and we have stored hundreds maybe thousands of documents in it config files and For whatever reason I lose my computer or I have to do an extreme distro hop and I didn't have any backups So let me clear the screen. What I'm going to do is I'm going to do a RM dash RF very dangerous command on The test repository I'm not in the root directory. Let me CD back into root and then do RM dash RF test And when I do an LS there is no test repository. I just blew that repository away. It's gone Well, did I lose all my documents? I lose the doc zero one dot MD and the read me dot MD and then the license file No, because they're all they're all still on git lab and remember all you need to do is go get the clone URL So do do the get clone again. So grab that URL and go back and do get clone The URL cloning into test now when you do an LS Test is there if I wanted to and CD into test just to verify do it LS and there you have it We didn't lose anything now. You can go much deeper with yet There's a lot of advanced stuff you can do with get especially once you get into Development projects you you start doing things as a collaborative effort with other people Maybe working on open source software because then you have to worry about creating other branches other than just the main Branch or the master branch, you know, you're probably going to have Development branches and you got to worry about merging everything together and you know You got to take your commit message is a little more seriously than what I was doing here You know, there's a lot to get but for most desktop Linux users that just want to back up their dot files The commands I've already shown you are pretty much the ones you're going to use all the time There's really not any others you're going to use get add You know to add something to a staging area get commit and then the name of the message And then you're going to do get push to push it to your get lab or get pull to pull it from your get lab if they're out of sync or you're going to do get clone name of URL if you need to clone a repository some other commands You'll occasionally use I don't use these very often, but if you wanted to view the log You could do get log and as the name implies this is just a log of what's been going on with this repository Who's been committing what you see all the the latest commits Which there's just the four or five that I've made since starting this video Exactly the files that I was adding or removing or whatever it was I was doing and then you have the Basically the hash for each commit though the number some other common get commands include get branch If you needed to create branches, I don't ever do that because again I'm just working by myself on my own stuff. You could do the get fetch and Get merge and things like that. You those are often going and grabbing something from a remote repository and Making them work with the local repository. I actually found a great diagram and when I was getting ready to do do this video because visually it's hard to kind of Visualize what exactly get does I think that's why so many people have a problem with get but I found this great web page Then actually has a visualization of actually what goes on when you run the various get commands. So imagine you have four Working areas basically of get you have the working directory, which is that directory that you have that local repository on So so my test directory that we've been playing in that's the working directory When I run a get add it takes it to the next area, which is a staging area when I run get commit It takes it to the next area, which is the local repository or the head and then finally when I do get push it takes it to the remote repository or the master and then if you want to go the other way get fetch takes something from the remote repository the master and brings it to the local repository the head get merge would take it even further from the Local repository all the way back to the working directory or when we do get pull It just takes something from the remote master repository all the way back to the working directory. So I Really glad I found this little Graphic here. This is actually pretty neat. I think that when you see it, I really think it helps beginners to get able to understand what's going on because just having somebody open up a terminal and typing these commands You really can't figure it out. It really is hard to grasp Even when I was trying to figure out all the get commands, you know Some of this stuff can be kind of hard to wrap your mind around one good thing with get lab is they have Fantastic documentation so they have like the get lab basic guides And it tells you all you need to know about how to work with the get lab website How to use get you know, there's your standard command line get commands It'll tell you how to get SSH keys set up so you can use SSH keys for your get lab And what this does for those of you that are not familiar with SSH keys These are keys that when you remote into another machine You don't have to enter a password, right because those machines are trusted You know those machines know each other and with get lab if you're constantly Pushing and pulling and doing get clones and things like that You don't want to have to be entering username and password all the time if you have these SSH keys set up What it does is when I run a get push in my test repository It's gonna know who I am because I have the SSH key on my machine here my local machine I also have the SSH key on my get lab account. So these machines know each other I don't have to verify that I'm me Let me run through the basics of setting up the SSH keys for those of you that have never done it You need to run the following command SSH dash key gen We want to generate a new SSH key space dash t space RSA. So this is the type of key We're creating RSA. This is the encryption space dash B for bit size the number of bits that are gonna be Part of this key 2048 is the minimum Most people recommend and it's the minimum that get lab recommends by default if you don't do the dash B flag It defaults to 1024 but for security purposes, you know to make it a stronger key You really should do at least 2048 and then give it the dash C flag and Then typically some kind of description typically an email So I would do something like Derek at distrotube.com and I would hit enter I don't want to create a new key though because I've already got one by CD back into my home directory and I CD Into dot SSH. You have a hidden folder in your home directory called dot SSH if I run it LS You see I have ID underscore RSA. That's the file It creates when you run that command by open that file, which I won't do because it contains the key The key is in that file copy that key And what you need to do is go back to your get lab page and go to the top right and go down to settings And let me Uncollapse the sidebar here. You have SSH keys Click on that and then you have this window here with this box Paste the key that you get from that file that ID underscore RSA Dot pub paste the contents of that file into this and then this button here add key is going to turn red Click add key and you've added the key now once you've added the key now instead of using HTTPS to do your cloning and pushing and pulling and all of that you can use SSH To do all of that and you will not be asked for a password So I've gotten back into the test directory and what I'm going to do here I haven't added anything or committed anything, but if I ran a get push just to show you guys It's going to default to asking about my username for HTTPS colon slash slash get lab comm is using the standard web address Let's make it use SSH instead and how you do that is whatever get command your with push pull clone whatever get push and then do get at Get lab comm colon Wt one slash test dot get and that forces it to use SSH and You see it didn't ask me for a password or anything and it tells me everything is up to date There was nothing to do anyway because I hadn't committed anything new But had I done it with just a this is the standard HTTPS way It was still going to force me to use a password You know enter a username and password and then tell me everything is up to date So that was just verifying that my SSH keys are in fact working So I think that's really where I want to stop with this basic get and get lab tutorial today One thing I do want to mention is my dot files repository, which has you know all of my configs for my tiling window managers and various other programs This is not a standard get repository. This is what is called a get bear repository Meaning my home directory is not really a Repository, I mean technically it is because I push all of this stuff from my home directory on my local machine And it goes to this dot files repository over on get lab But you can't really make your home directory a get repository If you're going to have Subdirectories in your home directory also get repositories because there's gonna be some conflicts You will occasionally run get commands in those subdirectories and it'll be confused It's like well, which repository are you running this command on are you running it in the home directory? That's a get repository or you running it in the sub directory, which is also a get repository So to get around that problem What most people do is they'll will set up a bear repository and if I go back to the terminal here Let me show you guys what's going on there. Let me CD into my home directory So my home directory, you know, I could do a get add and a get push and all that but My home directory technically is not a get repository if I CD into this directory the dot files directory This is actually a get repository, but when you set up a bear repository a bear repository means this This get repository this dot files repository stays empty. We're not actually working in this directory It's technically the get repository, but all the commands I run are going to be on a Different working tree and in my case the working tree is actually the home directory I know that's kind of complicated I did a video on how to use get bear repositories for backing up your dot files Oh a couple of years ago. It's not the greatest explanation in that video But the reason you do that is so you don't have conflicts if you want to use basically your home directory as a get Repository then the way you need to do that is with the get bear repository So I think all of you guys really need to start using get to back up your config files your dot files It makes sense. There's no reason everybody shouldn't be doing this now. I need to think a few special people I need to think Michael Gabe Nate Corbinian Mitchell entropy UK John Devin Fran Arch 55 30 Chris Chuck DJ Donnie Dylan George Lewis I'm report Robert Sean Tobias and Willie. They are the producers of this episode They're my highest tiered patrons over on patreon and without these guys You wouldn't know how to back up your dot files using get and get lab You wouldn't know about it The show is also brought to you by each and every one of these ladies and gentlemen all these names You see on the screen right now. These are all my supporters over on patreon because this show is Sponsored by you guys the community if you'd like to support my work check out distro tube over on patreon. Peace