Ask an Expert: How to use Github, (Conflicts & SSH)
Key Takeaways
Explains how to use Github, including conflicts and SSH, with pro developer Michael
Full Transcript
[Music] hello welcome back to another scrumpy live as you know today we are hopefully talking to michael so hopefully because he's not here as you can see i hope he's coming in a minute because nobody wants to listen to me talk about github that would be useless unless you want to listen to realize how much more you know than me i guess in the meantime i will beep on about the weekly web dev challenge yes this one here um is an accessibility challenge based on what we learned last week with carrie fisher senior accessibility trainer that's the wrong one that's my channel accidental plug yes here we learned all about accessibility and now i have a challenge about it too so why not give it a go yes michael's here now yeah olly he's still in his box he's out of his box now say hello to everyone hello everyone dan pitts you were second today yeah and kevin says um i should probably learn how to get started with github first oh yeah refers to this um by all means go and watch this after the stream it will be very handy for you but if you haven't watched it yet do not worry because you never know what kind of useful information you're going to pick up so that's right stay tuned i would say you can always go to that one afterwards yeah i would say crikey yeah lovely who else is here so many people wow if you're new type a rabbit and um if you've been here before type a um tiger that's the word for it yes hello hello hello oh linkedin user hello yes i forgot we're streaming to linkedin how are we we are yes linkedin github twitch yes cool prasanth says i have done the github token thingy for android studio i haven't done it for visual studio code you know what that means uh you will learn how to do it today okay that's what we want to hear great news there we go oh lots of tigers ew but also lots of rabbits yes okay then michael yeah so what are we gonna learn today tigers lots of rabbits yeah so what have we got on today then uh cool yes so today we will learn how to uh resolve github conflicts very very and also we will learn how to set up your ssh keys because these um well github conflicts is painful but ssh keys usually it's something you do every time you join a new job uh so and it's a little bit daunting because they just kind of say set up your ssh keys and that's kind of it uh so what you do want to do is it's better to have some warning ahead of time but luckily they're a really good documentation there's really good recommendation and they shouldn't really be that bad so it should be too bright just hoping yeah and also if you missed uh i think that way um somewhere over there there should be chat on youtube and leon probably already shared the previous session where you can learn how to create a repository how to do branches how to clone um yeah other stuff where isn't that one no that's this one uh i don't think you're sharing i know i'm trying to get the link oh i see yeah here we go here's the link to the previous one if you would like to watch and here it is where are we oh i was wearing a different shirt oh well i was wearing my other shirt that was over a month ago so yes on that topic dan pitts says michael's looking clean good news is in clean shaven i love the tiger i don't know cool trevor says sx ssh keys always take me days so looking forward to this help okay i don't even know what they are so awesome okay so uh yeah let's firstly start with uh something a bit more straightforward so i have already set up a repository for all of us yeah so i have already set up and i invited you into that repository as well then you did and uh didn't want to accept invitation or anything like that i did so oh caffeinated pixels likes my plants thank you apart from pumpkin so what we're gonna do is we're just gonna go to my repository that i've set up previously and if you want to have a look there you can do that yourself too uh so it's just a minor which is my name and then get 102. because the previous one was 101. yeah hey anyway so uh that's kit 102 and then i have created two branches uh so one of them is called conflict another one is called maybe conflict anyway uh there's not really much to it it's just one file so we're trying to make this as straightforward as possible um and what we are basically going to do then is try to resolve some of the conflicts so i had a pull request over here so for these two and basically a conflict occurs when for example you have one file like as in i'll just display it on readme's and let me just zoom in a little bit so it's a little easier so the conflict would appear for example if uh someone edits a line and then someone already made further changes to it and then you're trying to bring your changes once the thing has moved on it's kind of like you know um you're going on an alternative timeline you're trying to do your thing and then the previous time has already moved on and potentially when you're coming back uh you're not really coming back to anything meaningful anymore so let's say if i decide to remove this line and someone else removes this line instead and then they push to main then i'm already out of date and when i'm trying to merge it all together it's quite likely that we'll encounter the conflict uh so what happened here so for example if i go to the first branch you will see that i say file changes i can click on that and i read things uh well this is pretty this is the case so there is uh i basically updated some made some changes so i've changed some wording from there is a conflict and conflict branch saying look at this awesome branch there is no conflict that's it like it shouldn't be but when you're doing the pr what uh github tells you is that it says conflicting files and there is it tells you which file you've got a conflict in and you can click this button and it says resolve conflicts that looks tempting yeah you click there might be drawbacks to doing that yeah um mainly because kind of this editor well it kind of sucks so there's no two ways about it uh but basically it gives you the line it highlights with these exactly what the conflict is so we can see that it looks like the same line over here was changed and now you have to choose which one is better which one you want to keep and which one you need to delete so it basically says there is this piece of code in branch conflict this is the branch name and this is another branch name so it basically delineates two separate ones it basically tells you that inside of branch conflict you have this line of code and inside of this is like a separator there is another line of code that is in the main and git tells you i don't know which one you want so tell me normally it tries to figure it out as best as it can but oftentimes uh when conflict curse basically gives up and says you decide now so just recap conflict is a separate branch and the line in main is different to the one the same line in conflict correct and now it's asking you which one you want but who can actually choose this can anyone do that uh yeah basically you all the maintainers so for example when you go to the maintenance or your project or something uh i'm not entirely i can't remember where you see it um contributors there we go yeah uh that might be based on data rather than yeah it doesn't tell you how many people actually belong to this uh but anyway yeah so what you can see is for example when i'm in main branch uh there is so here is this line it says there is a conflict in conflict branch maybe not who knows and when i go to the other branch on this line there's a different text makes sense just to recap on the chat yeah um how can you do this at the prompt we will uh cover that yeah come to that a bit later yes you look clean shaven as do i i'm glad i look clean shaven i'll be worried if i didn't um are we going to cover that you don't have to shave at all yeah and we're going to discuss about the differences between ssh and http um very briefly because to be honest uh when you join an organization but you're not going to be debating uh the merits of it kind of your organization will tell you users they should use this to sage to clone your repositories and you won't really have much say in this uh so academically there is there is a point to discuss this but i don't think that we'll have enough time to cover this in the stream oh yes we've got some poetry naga mooner scream bar oh yeah very good yes so we've identified there is a conflict yeah and we've got to do something about it so we've identified there is a conflict so basically what we're going to do is we'll go in and as i already mentioned resort conflict so what you do is you literally decide these are called conflict markers so you really want to remove them so i for example need to have look at this awesome branch i prefer this text so what i can do is i can remove these markers remove the line that i don't want and remove the last marker and that's what i want so then i can just hit it i can choose like previn next it basically tells me it tells it like show me the next uh or the previous conflict if you've got multiple uh but i feel like if you've got multiple you need to go into your vs code and we will try to do that next so and that's it you can just say uh mark as resolved it gives you green tick saying that okay cool i don't see any conflict markers that's amazing and now we commit merge and there you go it basically says that you have resolved this merged into conflict and then you can merge pull request cool and you confirm merge so is that merging it onto the main now yeah it's now in it's now in maine and there you go i've deleted the branch clean this up cool so then you're like okay let's review another conflict and i've been really productive with creating conflicts so there you go for a change yeah and there we go it says this branch has conflicts that you must resolve again uh and then you can do the same thing again but you can see that this is oh this is a little bit of a bigger problem to resolve so you're like yeah i'm not i'm not doing this through the editor because i'm not entirely sure i want uh syntax highlighting the rest of it uh so we'll go and have a look into command line how to do that from your local machine shortly after we have looked at this question from palm beach sure so basically a conflict because when the changes happen inside the same file uh yes it could be because uh you have removed the file you have created a new file someone else has created the same file with the same name and now kit doesn't know which one to keep uh it's basically whenever you're trading on the toes of like between the developers you will have conflicts yeah srianz asks um can you explain in a basic way how to create a project on github i always get confused i think it's actually worth doing that uh the basic way how to create a project on github we have covered that in our previous stream i think it's worth going over now uh i'm i'm afraid that we might run out of time if we do that we might do yeah but if we have time obviously yeah and that's it's all in there yes okey-dokey what is ssh we will come to that later on i believe yeah yes okay cool on we go on we go we've basically we could change this here but because this editor's not the best it's um easier to do it elsewhere that's right so what we're gonna do is uh we're gonna fire up our terminal he's just clearing out the rubbish i type in my terminal endlessly yeah can you zoom that yeah 100 here we go my terminal uh if you can see that okay so we have like it's mixed so let's just i just cloned here okay so we'll just clone your repository into here so then basically says okay i want to clone this repository and resolve the conflicts locally good clone and there we go we're calling the repository and then just go get one or two whoops ls okay now we've got that let's clear this up uh just gonna type good status it says that i'm on the main branch so you've made a copy of it on your local machine now yeah so i've copied this repository git 102 i've copied it onto your machine and uh what i am going to do next is i also want to check uh your global editor okay check away so leanne uh has already set up her core uh for github config as uh vs code so i will quickly remove that just to show something and then we can close this file down i uh yeah you can say cool awesome okay so and i'll close your face code as well so anyway so pretend this didn't happen there you go so now you are working on your logo machine and you just want to go and say like okay so let's do now good check out so we normally do is you're on main and now you want to go to look at your other branch which was called maybe conflict so give check out maybe conflict branch cool and what does this actually do checking out so good check out basically you switch to this branch so it's like uh right now on the main and when i click this i get checkout maybe conflict and now i look at the different branch sounds good so now i did this in the cli i've checked out to that branch so what i want to do is when i have my pull request i basically said over here it says that you've got a conflict and what resolving conflict does it basically goes to your main branch and it merges it in into your conflicting branch so that's what we're going to do here we're just going to say git merge main so what i really do is i take main and i merge into the branch that i'm currently in which is maybe conflict okay and then what it does say it actually tells me ooh get conflict merge conflict in readme uh fix conflicts and then commit the result so why do you need to why do you need to do this so you want to do this because uh like if the changes are too big it's very hard to do them in the editor so you want to do it in your local machine first yeah and then when you resolve conflicts on your laptop you then push the new version that does not have any more conflict well why do you need to go to main to do this why can't you just do it in the maybe conflict branch well you are doing it in maybe conflict branch so what you did is you went to maine pulled it then you went to maybe conflict and then you merge maine into maybe conflict so even though this says get merged main it sounds like you're emerging it intermaine the actually you're emerging maine into maybe conflict it's but why because you don't want to merge maybe conflict into your main branch but why because that's what's going on that's what the pull request is for because you don't want to overwrite the wrong things don pith says shouldn't you generally be on main before merging yes and we were so are we yes we over here we say git check out maybe conflict so we wear a name we went to maybe conflict and then we merge maine into it oops kevin black so confused you're not the only one perhaps you better run over that again yeah michael normally one more time okay so those of us at the back so let's have a look at our closed pr over here when you go to this conflict you can see that we have there is a message here that says merch branch main into conflict okay so what github does with that special button it merges it for you and then it merges the pull request so effectively what you do is you create a pull request then you merge main into your branch and then you merge pull requests back into the main and i know it's really yeah it really sounds stupid yes can you say that again so you have you have your main and you have your branch you create pull request but if you have a conflict you have to merge your main into the branch fix the conflict and then and then merge your pull request into the main okay i think it's crystallizing in my brain now okay i think basically what okay so it's like if you want to bring your code into main you have to fix your own problems first and then you can merge yeah you can't merge and fix problems on the main that's you can but it's bad practice so essentially what you've got a local copy of the what's it called conflict maybe conflict branch and what you've got to do is now get the stuff from the main into that so you can sort out the conflicts after that you're going to put it back into the main okay so i think i i just went a little bit too fast with this so let's do it again so let's have a look i'm on right now uh oh actually i've started the merge so it's what i just said wrong no no that's all right we're just going to go over it again run pid says oh i get it now okay so let's have a look also if all of a sudden you have a problem with your merge here is a handy command git merge dash aboard it basically says like uh i don't want to merge anymore so let's stop this okay which way which is what we did let's go back to maine sorry kit check out rain there we go bottom right pits has summed it up nicely so if there's a conflict you merge into the secondary branch and resolve conflicts yeah and then merge the resolve conflicts into the main yeah correct exactly so yes i'm going to leave that on there for people to look at yeah cool so very good let me show you in the ui again so if we're in the main we have this problem so we have this text in the main branch if we switch to another branch we've got a different piece of text so when we go to pull request because they are different and they have changed to the point where git cannot normally what git does is it tries to consolidate it based on the time changes when you've done that so it can it can tell which is the preview which change is back in time but if you were doing changes like this then it wouldn't know which is more important so you have to tell it which one is more important yeah and it tells you resolve conflict and you can do it here in this ui and what git would do for you with via this ui it will basically merge main into your feature branch fix the changes and then merge your feature branch back into the main but unfortunately they haven't sorted out this editor to a point where it's but the editor is not the most helpful so you have to do some manual steps yourself and these manual steps would be in your cli you have to do the same thing euro on the main just using my shield you're in the main you pool that's all right it says already up to date cool we're good with that then you have to do the manual step of checking out the feature branch yourself that's maybe maybe conflict it doesn't autocomplete that's all right so i switched to it okay now i say good status it says uh and now i have to do it manually i say get verge main so now you've put everything from maine is now in maybe conflict yeah so now i'm basically saying okay all the changes that are in maine let me fix it in my feature branch and then i'll merge it back yep as dan pitt says there yeah on the screen dave says why can't we just give peace a chance peace isn't an option dave when it comes to github no peace is not an option okay so now when we have that conflict what you can do is you can say git div and it tells you like this so it gives you all of the kind of like all this gump and it basically gives you all these markers that you can resolve and normally uh what i advise people to do before you do any of this what you can do is set up your vs code uh as your editor so what you basically do it says git config global and then e means open it to edit okay would it not be the default no because when you install git the default is this which is vim yeah this so it opens in your terminal and if you type something nothing well i mean you can actually type stuff yeah and the thing is that like it's very non-intuitive yeah you're telling me and a lot of people get stuck in it so if you do get stuck in it okay which i do okay when you do we do is you hit escape and then you type column q which is quit and you type exclamation mark which is like fourth quid don't save anything yeah so i don't want to save any any of this okay and i left it so what you can do uh you can basically say let me show you how to do that so what you can do is you go ahead and you google get config location and then you type in your uh kind of your system windows or mac so we're on that can we go okay how to locate good config file on mac so this is going to make it say that the branch you can open it in vs code and not indeed so what you do is it says home and it says git config okay okay so home is like this so let's have a look is it actually cat which means it basically means list the file uh home got git config okay cool and there's that file so what i want to do is because i have vs code installed i can just type code and then i can type the same file name git config that opens vs code and what i want to do now is i want to say there is like a little snippet that you can paste so what that means it basically says create the main editor will be vs code and then there's just some also other setting and the way you do that is you just google git vs code as main editor okay and then you go there and some will there will be plenty of different articles that basically like yeah copy this into your git config and you'll be fine so that answers dan pid's question could you show the command to set up vs code as default again that's all of this right yeah so the command to setup it as vs code so basically the location where the config that you need to update on your machine is located in your home path git config but you can google where is give config on windows or where is git config on linux although on linux it's the same places as on mac so if you're on windows just google where it is and it will give you a location if you're on mac this is it you can find it there open it in code with this so like that git config you open it and then really the magic line that will do most work is this core editor equals code dash dash weight it basically means wait until the vs code opens and then this is like the bonus on top you don't have to add it but if you want to you can find it by googling how to make uh vs code by git editor and that's it isn't line 10 the main one uh no because that's that's a separate thing but it will be beneficial because some tools call these lines on your behalf uh in vs code okay so that's all separate that's an interesting one and what's the difference between github desktop and get a command line uh github desktop is just uh like another program that is like another layer on top of command lines uh but the problem with that is if you get used to github desktop and all of a sudden you get yourself into a problem out of which you can't get out of there's not much help for you uh all of the help that you will get will usually be about get with command line so it's best to get used to it now it's kind of like you know learning how to swim in in a kid pool but if all of a sudden you get off a boat you won't really get much help so it's better to learn how to swim in the sea or not get on the boat but not getting on the boat with git is not an option you have to be on this boat basically github desktop is an application that does a lot of this for you but not really all of it and if you get any troubles it can be hard to sort it correctly okay okay on we go yeah so let's save this we close it and let's let me remind you the reason we do it is because we want to resolve conflict okay and uh most conflict resolution tools make you enter vim and you don't want one to go into vim okay so what we want to do now is we can type the conflict resolution code uh well like how to resolve uh the conflict with vs code so what we're going to do now is we're going to open vs code again on this folder and then yes i trust the authors okay okay and then when you go into source control tab you will see that it tries to merge and there is this like little exclamation mark which is a marker for conflict so you click on it you go look at this highlighting see um anyway yeah much nicer so head it basically tells you this is your current change and this is the incoming change from the main so this is the branch you're on and this is the main branch and then there are also buttons that tell you like you can just hit this and it will edit everything you need so you can say accept current change incoming change or you could for example keep both and it will just delete the markers for you anyway so i think what we need to do is we need to resolve all the conflicts i just hit accept current change does all the magic and you save it and you just hit okay uh ah sorry no changes to commit yet i need to stage that and that's it that text wasn't necessary awesome okay and now when i get status it says all conflict all conflicts fixed you're still merging okay so what i want to do is kit push everything is up to date if i go to my pull request now on here i should hmm why didn't i push oh no oh no oh yeah i need to uh i need to commit it i think okay here we go so yeah forgot to commit there you go so you need to commit your fixes and now i can push there we go and pushed and now you learn how fixed the merge conflict and now it's all green it changed pretty much live as it uh and as their content says you haven't committed it exactly awesome and there we go oh [Music] and now we can all merge that and we've fixed all the conflicts and delete the branch what are these numbers here uh that just indicates uh the line changes on the file so like one line added one line added five lines removed hey right so now uh on to ssh but let's probably answer the questions if we have only from ebay cool uh where's the defense building get bash and command line uh when do you use which uh so on mac you will use terminal and uh gitbash is based like a windows version approximation of that uh so the same thing basically kind of yeah um it's like a flavor of bash which is a flavor of shell um which is probably the flavor of something else but to be honest i'm not super duper expert in linux different shells so bash's is linux yes well kind of okay it's complicated it's complicated uh so command line is just a generic term for all of these different shells all right yeah okay earlier on um if i may there was a question um from [Music] well okay there was a question is there a git cheat sheet we can download um to be honest i would just google cheat sheets and try to find out which one you find the most but i would probably delete most of the stuff on the on those cheat sheets to just have the main thing you need and that's it yeah that's true yeah okay so should we move on to ssh cool yeah so uh quite often what you do have is basically uh like why do people need to use a search and what is ssh it's okay uh so what is sh is really big topic so i would just like it stands for your shell protocol that's right so it's just a way of transfer information like from one computer to another computer so the way you interact with https like your browser uses one type of protocol uh http to interact with websites and they trust this information like website for example takes html css javascript files and it transfers into your browser and it opens them in your browser and that loads ssh is very similar but the communication doesn't happen over http it happens over shell protocol which is like within your terminal um for so it's kind of if you want to think about it you can say that ssh is like http but for your terminal uh interactions you can also use http inside of your terminal okay anyway so https is a secure version of http so you basically untangle and secure stuff from people so they don't know what's going on and ssh is kind of like that as well it basically obfuscates information so if someone is listening to what you are transferring between two computers even if they get the information they wouldn't be able to tell what it is because it's all gobbly and what kind of things would you transmit with this so like for example when i go uh to google and i say and i google ssh uh the information happens over https so information flows from your computer to google servers and back and if someone care listens on the connection like for example if i sit with special device and interact intercept all the packets that go from your laptop to wi-fi and so on then i wouldn't be able to tell what's inside of them because they're encrypted with special keys again how that happens is there's so much information about that there are really amazing youtube videos i'm in no way qualified to explain it properly but think about it like it's basically a way to make sure that no one is listening when you're talking on the phone i don't like that yeah so https does it for http no one can listen on your http phone calls it's not really a phone call and ssh does it for your shell communication so whenever you go for example uh you know like when you say good push what it does it transfers files from your computer to github servers and it uses https for that information but there are some drawbacks to using https so and the problem with https is that you're look you need to log in with git yeah so when you first set up your git machine you have to log in with your username and password so for example when you push something uh you usually get prompted uh what's your github username what's your github password and that gets saved on your machine so for example if someone steals your machine then they would be able to then open your terminal and push stuff to my repository would they so no crabs often times what people do is they say set up ssh key so you can revoke it and you wouldn't be able to push it there are also other benefits but kind of the main one is that it's easy to revoke your access with ssh keys so if you leave your laptop on the train as michael has on occasion you can revoke access and people can't listen in on what you're sending to github i think is what he means yeah pretty much okay you wouldn't be able to listen in what's going on with uh your communication with github there are some benefits there as well apart from that and also it's the ease of revoking your access to pushing so for example if i lose your laptop you will still be able to go to your github repository and say these stage keys that are stored on my computer uh i can delete them so whoever tries to push through these repositories wouldn't be able to okay great how do we do that then so how do we do that um again there are really good docs uh for that too so yes but we want you to tell us michael that's right uh and often times when well we'll kind of also walk through it so github actually itself tells you how to do it properly um and so you don't get scared it's actually pretty straightforward so we'll pretty much walk through together because this is like the main guide for people to do okay okay let's do it okay let's do it okay i hope you'll feel ready now yeah so what we need to do uh so let me just um let me just quickly remove this whole repository we are done with an app mrf and i let's say get 102. okay cool there you go it's all gone so now your ssh keys on your computer are normally stored in your home directory dot ssh so you can just go there it's just going to show all my keys on the screen so you can just list them and as we can tell you've got no keys oh that's okay you've got no ssh keys on your computer so what we need to do is we need to create some you didn't actually ask me before you did that so if i had that i've checked your computer before i don't think you have so you just assumed that i wouldn't know how to set it up so i don't have any no i i checked it i checked it during the lunch so okay uh there is a cli command ssh keygen and it's usually pre-installed on pretty much every single laptop so you will have it installed and you can run that so it gives you the command here so ssh keygen t stands for type and this is the type of encryption uh you can just copy that copy that type of encryption that's all good uh and then it says dash c which is comment your email address so basically it provides a comment for you so if you come across and you're like what's this key again uh you will see inside of a file it will tell you what the key actually is okay so you can do that and don't worry we'll also record it on the stream but all these keys will be destroyed after the stream so you wouldn't really be able to do anything with them anyway okay jessica asks would the keys be visible if any existed yes oh so when you say ls well i'll show you in a bit just be careful on that one then yeah yeah so what we're gonna do is click that there you go okay it says generate in uh there we go so it says a public private encryption type key pair so it will this key gen will create two different keys one of them is private which you do not show to anyone another one is public which you can share with anyone you want okay now it tells you uh you need to create the password for that file uh so i'll just create some password which was which will be pumpkin123 i'm sorry that's the file name whoops anyway the keys will be deleted anyway so it's okay if you know my password and so the file name will be i normally try to create a file name which is like descriptive about where it's uh what's it meant to be used for and that would be uh leanne macbook git hub okay and now i can put pumpkin one to three and then it says again with pumpkin one two three okay cool uh it has generated uh alien communications yeah it generated the key this is the comment that we've given and then it just gives you some art anyway so when you type for less random art when you type a less here is your key so we can for example have a look at uh big key there it is and then you can also have a look we can also have a look at your private key all right now there you go here's your pro key just a note we're showing this for the stream never ever ever share this with anyone so this is if it says private it's private it's like nobody can know this so it's better even if you don't look at it yourself you know um to be fair like because you might remember it yeah exactly i mean if you have photographic memory there you go you might remember it uh anyway so there we go now we've got those keys what we want to do is the next step would be adding it to ssh agent so ssh agent is a special utility that uh basically manages the key for you so every time you would try to do something with the key it will just help you like you won't have to provide it or anything it will just do it for you so all you need to do is like a password manager yeah it's like a password manager who uses h keys that's right so this one is let's check it's running and it's running so it's it will give you peter's process id and this is on your machine this is where it's running okay and then the next step will be basically just say ssh add so let's just type that ssh and key and you just give the path to that key which we have just created and then uh what was that yeah there you go so you give to your private and it says give me a password um everybody remembers pumpkin123 okay we've added that identity and now what we need to do it then just says add your ssh key to your github so we have created the pair private and public you add private to ssh ad and you add public to github.com so what you do is usually you can say cat which is list uh like i'll put the inside of a file into here so cat public key there you go so you can copy this and then you can go to github.com go into your uh settings and then there will be ssh and gbg keys you click on that add ssh key you say new ssh key title macbook [Music] so this title can be anything but as i said it's very if you keep it descriptive like uh who is the owner where is it stored what is it for uh or you can reverse it anywhere you want you can just actually write leanne's macbook private key for github so it could be any name you want okay and then when you add a search key you will be prompted to put your password okay and there you go you've added it so why do we do that so what we can do is now you can when you clone repositories so we go back to our whoops so we go back to our github 102 so when you click code there is a tab over here that means ssh so you can tap on that and now you can clone uh your repository using ssh protocol so now we just go to i think it was in documents in new delhi yeah yeah so i have deleted it and now we can clone it with ssh all right yeah so it's exactly the same but now i don't have to put my password in i don't have to do anything it ssh ad already knows uh that if there is your private key in it and when you use an ssh it will use that to basically unlock all the doors so think about ssh as like that key card in the hotel you know you don't have to put the key in the hole and anything like that you just swipe it and it lets you in uh and now that's that's kind of it i'm you know you can do anything you want uh so what we're gonna do is for example let's let's make some changes uh we open this up actually no i i need to go into the get 102 folder that's right okay so open repository up there we go and now for example hello uh from with ssh cool and pumpkin and pumpkin okay so now i can just say get uh add it um let's say learning ssh cool and now i can just say good push and that's it we have pushed it and now if we refresh the repository there you go it has uploaded it so now uh what ssh allows me to do is remember like we mentioned uh what's gonna happen is all of a sudden somebody steals your laptop and what you can do is you just log into your github and you say okay i don't want this key i want to delete it delete it so now if i go back to my repository so i've deleted the ssh key uh i'm uh but i want to steal your repositories there you go and now we can also commit that proper commits i mean it's surprising that you know some you know some robbers were leveling up you know in github and they stole your laptop and now they want to steal everything could happen yeah it could happen so now when they're trying to push your repositories later they get permission denied could not read from remote repository essay yeah that's right that sound is called piano loser yes okay and now that's pretty much it now you know how to secure everything with your ssh uh how to create that pair and uh kind of also if you are just practicing github on your local machine then if you're really tired of inputting passwords uh on your local then you could just grab a key pair uh create the ssh and that's it it would be way easier for you to work with your local github repositories so some people for example me have received an email saying from github you recently used a password to access your repository basic authentication or authentication using a password to get is dedicated and will soon no longer work what's the solution to this then uh yeah uses the sage keys because you gotta do it all the time now well soon you will have to do this uh well luckily you do it only once and that's it oh okay yeah so you create the keypad you'll add your private key to ssh ad you add your public key to github and that's it that's done okay so great news yeah uh and i'll just clean up your off the screen i'll just clean up your ssh keys so you don't need this and that's that so now you know no nobody can use that anyway because it's been deleted so it's been deleted it no longer exists there you go hmm so what's the difference between ssh key and personal access token when do we need to use personal access token so think of think of personal access token as like a one-time ssh key so you gra you grant it for one repository uh to do what you need while ssh keys can be reused in different uh in different places but use the ssh okay you have to clone specifically with ssh for this to work yes correct if i'd used https it would still be vulnerable uh i wouldn't say vulnerable you just wouldn't be able to use ssh to work with your repository but what you can do is in the previous session i have shown about every github repository uh let me clear this up so inside of any github repository on your local machine you have a less and that lists all your files but if you type lsa uh that lists all the files and there is dot git folder in there so docket folder has all sorts yeah ls oh yeah so there is kind of it has all the information about github uh on your local machine so what you can do there is that file over here called config so if you open it this will point to the branches that you have this will point to origin and over here it says url and it says github and it points to the url that you have used from here so like that so what you can do if you cloned it with https you would have like this all you need to do is just go to your repository hit on ssh copy that and replace that url with ssh link save it and now you can use your ssh key for existing repositories so you don't really have to delete all the folder and clone it again you just replace uh ctps with ssh and you're good to go again nice great news dave says where are you getting these sounds from well dave that is a trade secret okay never let them see how the sausage is made to finish off oh oh actually no let's have a look at the current submissions for the weekly web dev challenge as you may know well i mentioned earlier we have this accessibility challenge which will now be in the chat and yeah already got some nice submissions dave this is yours this is cool because i have this and then if i put my machine uh i think it was in here on to dark mode oh wow yeah this is with the media query oh wow what's amazing i know yeah very nice days and we have this one now no one can say this doesn't have an outline look at that outline very nice yes super cool and then yes very nice one and the outline matches um the button color neat i think so and then miranda has made this lovely one with a um gradient and a palm tree background nice and responsive lovely okay yes so do submit your um solution to this make this form nice and accessible yes and maybe you will get six months free of scrumba pro next time github tutorial of project management and other stuffs please can you help designer of project management would that be github or like i don't know we can do one on project management that's a good idea oh fair enough i have a question on submitting the challenge when i'm done editing the live stream and going back to the video so as to get the pre-loaded tweet i notice that all my edits on my scrim disappear well um so you see here there's this uh little tick if you tick this and then you can open it in a new page now that gives you a new screen link yeah this is the link you should share yeah and hopefully what you've already done will be saved here in notes yeah fingers crossed but i went ahead and sent in my work does that mean when i submitted the link none of my work was sent in um if that happens i'll let you know basically sometimes people do that and they send me the link to the actual challenge but i just say to them can you send in your solution yes yeah so finish slightly over time never mind also what do you do when you really screw something up and need to go back to your previous commit if you really screw something up well you can go back to the commit by saying git checkout and you give the commit name uh but if you have really really really screwed up uh delete the folder on your local machine and clone the repository again and if you've already pushed it uh well hopefully like speaking from experience yeah if you work on your own it's a mistake that you will learn from which is good uh if you work with someone else before you screw something up and you're like oh i really don't know what i'm doing ask for help like with git it's a absolutely 100 if you're not sure about something ask for help because you know it's like um it's like a very dangerous animal that you do not know what's going on with so feel free to ask for help maxim just pointed out that you can't actually see the tick so i'll do that again this yes start editing code and here it is this one here yeah at the bottom and then this open new page yes um how can i get six months free of scrimba um by winning the weekly web dev challenge yeah yeah you can do that does it have to be in scrumba can it be a git hosted project it can be a git hosted project yeah some people send those in yeah is that that's it yes what about git rebates how does that work well that is definitely a difference a whole separate live stream four separate live stream okay doki okay then well that's all for now thank you for joining us we will be here oh i should have not me it will be here there yeah here no no no not that one upcoming yes here friday we will be making our own nice accessible form oh actually if we're looking forward to learning about it yeah it'll be nice yeah so hopefully you can all come along and see us coding and see our cut pumpkin yeah live in action cool thank you thank you oh nice good to hear if you still have any questions reach out to us on discord well reach out to michael i'm unlikely to be any help but i can try and uh oh yeah don't forget we always forget don't forget to like the video and subscribe to the screen by youtube that's right yeah really good oh i feel so bad for saying this why oh i don't know it's just like as if like i'm i'm asking well what's wrong you can check out my youtube channel oh yeah there you go i have got a new video coming soon this week i think um about html meter and progress bars is screen birch youtube channel i'm not subscribed to you no well there you go click it no why not why don't i i don't think i should oh anyway well don't be on my scrambler youtube channel and subscribe to leanne sorry maybe i should i feel bad doing it myself oh come on go for it go for it do it do it do it see you on friday see ya
Original Description
🎓 View our courses: https://scrimba.com/links/all-courses
In this stream, pro developer Michael dives deeper into how to use Github, including dealing with conflicts and connecting with SSH.
🖥 Contents 🖥
0:00 - Introduction
3:02 - What are we going to learn today?
10:24 - How can you do this with prompt?
10:42 - Are we going to discuss the difference between SSH and HTTP?
13:38 - So basically a conflict occurs when the changes happen inside the same file?
22:38 - If there is a conflict, do you merge it into a secondary branch and resolve the conflicts, then merge the resolved conflicts into the main again?
29:00 - Could you show the command to set up VS Code as default?
30:21 - What is the difference between GitHub Desktop and GitHub command lines?
35:09 - What is the difference between Git Bash and command line? When do you use each?
36:08 - Is there a Git Cheatsheet?
54:21 - Some people have received an email about using a password to access a repository and that this will not work soon, what is the solution?
55:33 - What is the difference between SSH Key and the personal access token?
56:03 - Do you have to clone specifically with SSH for this to work?
💻Check out Scrimba’s interactive learning platform:
Scrimba: https://scrimba.com/
🐦Say hi on Twitter:
Scrimba: https://twitter.com/scrimba
Leanne: https://twitter.com/RybaLeanne
Michael: https://twitter.com/alanmynah
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Scrimba · Scrimba · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CSS Grid Course: Learn the Basics in 3 Minutes
Scrimba
CSS Grid Course: Positioning Items
Scrimba
CSS Grid Course: Why Learn It And How It Compares To Bootstrap
Scrimba
CSS Grid Course: auto-fit & minmax
Scrimba
CSS Grid Course: Implicit Rows
Scrimba
CSS Grid Course: Fraction Units And Repeat
Scrimba
CSS Grid Course: Justify Items and Align Items
Scrimba
CSS Grid Course: An Awesome Image Grid
Scrimba
CSS Grid Course: Named Lines
Scrimba
CSS Grid Course: auto-fit vs auto-fill
Scrimba
CSS Grid Course: Justify Content and Align Content
Scrimba
CSS Grid Course: Template areas
Scrimba
27. Setting up the structure - Responsive CSS Tutorial
Scrimba
25. Making the navigation responsive - Responsive CSS Tutorial
Scrimba
36. Playing with the title's position and negative margins - Responsive CSS Tutorial
Scrimba
31. Starting the CSS for our page - Responsive CSS Tutorial
Scrimba
26. Taking a look at the rest of the project - Responsive CSS Tutorial
Scrimba
15. Spacing out the columns - Responsive CSS Tutorial
Scrimba
33. Starting to think mobile first - Responsive CSS Tutorial
Scrimba
22. Making our navigation look good - Responsive CSS Tutorial
Scrimba
37. Changing image size with object-fit - Responsive CSS Tutorial
Scrimba
44. Module Wrap up - Responsive CSS Tutorial
Scrimba
16. Controlling the vertical position of flex items - Responsive CSS Tutorial
Scrimba
39. Setting up the widgets and talking breakpoints - Responsive CSS Tutorial
Scrimba
42. Setting up the About Me page - Responsive CSS Tutorial
Scrimba
35. Changing the visual order with flexbox - Responsive CSS Tutorial
Scrimba
23. Adding the underline - Responsive CSS Tutorial
Scrimba
21. Using flexbox to start styling our navigation - Responsive CSS Tutorial
Scrimba
20. Creating a navigation - Responsive CSS Tutorial
Scrimba
40. Using a new pseudo class to wrap up the homepage - Responsive CSS Tutorial
Scrimba
43. Fixing up some loose ends - Responsive CSS Tutorial
Scrimba
32. Starting the layout. Looking at the big picture - Responsive CSS Tutorial
Scrimba
24. A more complicated navigation - Responsive CSS Tutorial
Scrimba
28. Feature article structure - Responsive CSS Tutorial
Scrimba
34. Styling the featured article - Responsive CSS Tutorial
Scrimba
18. Making layout responsive with flex direction - Responsive CSS Tutorial
Scrimba
19. flex direction explained - Responsive CSS Tutorial
Scrimba
41. Creating the recent posts page - Responsive CSS Tutorial
Scrimba
17. Media Query basics - Responsive CSS Tutorial
Scrimba
30. Home Page. HTML for the aside - Responsive CSS Tutorial
Scrimba
38. Styling recent articles for large screens - Responsive CSS Tutorial
Scrimba
29. The home page. HTML for the recent articles - Responsive CSS Tutorial
Scrimba
10. ems and rems an example - Responsive CSS Tutorial
Scrimba
1. Starting to think responsively - Responsive CSS Tutorial
Scrimba
4. Controlling the width of images - Responsive CSS Tutorial
Scrimba
5. min width and max width - Responsive CSS Tutorial
Scrimba
3 CSS Units. Percentage - Responsive CSS Tutorial
Scrimba
11. Flexbox refresher and setting up some HTML - Responsive CSS Tutorial
Scrimba
12. Basic Styles and setting up the columns - Responsive CSS Tutorial
Scrimba
8. The Solution Rems - Responsive CSS Tutorial
Scrimba
14. Setting the columns widths - Responsive CSS Tutorial
Scrimba
2 CSS Units - Responsive CSS Tutorial
Scrimba
7. The problem with ems - Responsive CSS Tutorial
Scrimba
6. CSS Units. The em unit - Responsive CSS Tutorial
Scrimba
13. Adding the background color - Responsive CSS Tutorial
Scrimba
9. Picking which unit to use - Responsive CSS Tutorial
Scrimba
Tutorial to Learn Alpine JS - Full Course for Beginners
Scrimba
Guide To Algorithms in Javascript [Binary Search] - Full Course / Tutorial
Scrimba
Learn UI Design [7 Fundamentals Tutorial] - Full Course for Beginners
Scrimba
Javascript Tutorial for Beginners [From 0 to ES6+] - Full Course
Scrimba
Related Reads
Chapters (13)
Introduction
3:02
What are we going to learn today?
10:24
How can you do this with prompt?
10:42
Are we going to discuss the difference between SSH and HTTP?
13:38
So basically a conflict occurs when the changes happen inside the same file?
22:38
If there is a conflict, do you merge it into a secondary branch and resolve th
29:00
Could you show the command to set up VS Code as default?
30:21
What is the difference between GitHub Desktop and GitHub command lines?
35:09
What is the difference between Git Bash and command line? When do you use each
36:08
Is there a Git Cheatsheet?
54:21
Some people have received an email about using a password to access a reposito
55:33
What is the difference between SSH Key and the personal access token?
56:03
Do you have to clone specifically with SSH for this to work?
🎓
Tutor Explanation
DeepCamp AI