megacolorboy

Back

Published on May 25th, 2020

Git

Set up a new repository

Are you new to using Git? Then this is for you.1. Set up a Git accountGo to GitHub and create your account with your email address.2. Create a repositoryJust create a new project with whatever you wanted. For this, you can just create or something like that.3. Initialize git in your project directoryNow, go to your project directory and initialize git by doing the following:4. Add your filesAdd your files to the repository by doing the following:Or if you want add selected files:5. Commit your changesBefore you push your changes, you need to write a message about what changes are done:6. Link your project to the repoDo the following to link your project to the repo that you've created in step 1:7. Push changesYou can decide which branch you wanted to push but initially, you'll have one branch, which is called :Or if you have an existing branch, just replace with .Hope that helps you out!

1 minute read

Are you new to using Git? Then this is for you.

1. Set up a Git account

Go to GitHub and create your account with your email address.

2. Create a repository

Just create a new project with whatever you wanted. For this, you can just create git-starter-repo or something like that.

3. Initialize git in your project directory

Now, go to your project directory and initialize git by doing the following:


git init

4. Add your files

Add your files to the repository by doing the following:


git add .

Or if you want add selected files:


git add file_1 file_2

5. Commit your changes

Before you push your changes, you need to write a message about what changes are done:


git commit -m "this is my first commit"

6. Link your project to the repo

Do the following to link your project to the repo that you've created in step 1:


git remote add origin https://github.com/youraccount/repositoryname.git

7. Push changes

You can decide which branch you wanted to push but initially, you'll have one branch, which is called master:


git push -u origin master

Or if you have an existing branch, just replace master with yourbranchname.

Hope that helps you out!