Hello!
This is Alex Gorzen from Liquid Web with our video on
How to Create and Clone a Repo in GitHub on Ubuntu 18.04.
GitHub is a free repository hosting service where developers add code,
control versions and updates, and share projects with a team or with the general public.
To download an existing public project, you do not need an account,
but if you want to upload your own code then the first you need to sign up for an
account on github.com.
The signup process is simple and free to do, takes only minutes to get set up and verified!
Now that we have our account, we can create our first repo.
Click on the Create Repository button on the upper left,
or the + box next to our user in the upper right works too.
Here we first want to give our new repo a name,
then a description just to give some information on what it's about.
Next if we want it to be Public, anyone on the internet can see the repo,
but we can limit who has access to commit updates for it.
Setting it to Private means only those we choose can see and use it.
Then it gives a few other options, it can add a README file where we can give
a description and instructions for the project.
A .gitignore that is used to exclude certain files from being uploaded.
Like if some files were private or just created for a user when run.
Then choose a license for the code's usage.
GitHub does encourage Open-Source licenses, but depending on what your project is, the
choice is up to you.
More details can be found through choosealicense.com.
Finally, click the Create Repository button and it builds the basic repo.
Now we can switch to our local Ubuntu 18 system.
This guide assumes you have git installed already, but if you do not,
please follow our guide on installing Git on your local system.
and first we will set up the local git user.
You can use your GitHub credentials or if you are in a multi-user environment,
whatever your team agrees on should be fine.
This will be what is reported when a commit is made.
Enter the command:
git config --global user.name "Your Name" git config --global user.email "YourEmail@Address.com"
Next let's make a directory that git projects will go into,
We'll create the folder in the location we want with:
mkdir git_environment
then go into the folder.
Now going back to the GitHub page, click on the Green Code button,
and it gives us the url to clone the repo.
Copy that.
Then take it back into the terminal and run:
'git clone' and then our url.
now we can see the directory with our project's name has been created,
so let's cd into that.
Run a list command to see the files, and we can see it downloaded the existing project files.
To share new files on Github, first let's create a test file in our project directory.
vim testfile
Add a few words to the file and save it.
Now if we run "git status" it mentions we have an untracked file,
and tells us to use "git add" to include that into the repo.
So let's run that:
git add testfile
now running "git status" again it shows that we have a change waiting to be committed.
We will commit this change with the command:
git commit -m
Then in quotation marks, put something that describes what was changed or worked on
to help track changes over time.
Run that and it shows the file has been added.
Now to get this uploaded back to our repository on GitHub, run:
git push
and log in with your github username and password.
The update goes through and looking back at the files in GitHub
we can see our testfile there with the text we added to it!
So that is the basics for using git and github.
With git there is a lot that more can be done with versioning and branches
that make it great for working with large groups of people on complex projects.
That's all for this video on How to Create and Clone a Repo in GitHub on Ubuntu 18.04.
For more how-tos and tutorials, visit our knowledge base at liquidweb.com/kb or our
YouTube channel for more videos.
Thank you for watching!