Skip to content

This is a guide for anyone new to git and github . this is 2023 updated version and sync with new github changes

License

Notifications You must be signed in to change notification settings

Erfan-ram/git-zero-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git zero tutorial

What is Git and Github?

Git is an open-source version control system used to track changes in source code. It has the ability to manage both large and small projects, with efficient speed and accuracy. GitHub is a platform that provides hosting for software development using Git.

Git is designed to be simple yet powerful, allowing developers to record change sets that can easily be identified. While Git is mainly used as a command-line tool, GitHub provides tailored user interfaces, including graphical desktop and web applications.

The main use of Git and GitHub is to store code securely, making them popular among software developers. They enable users to collaborate on different projects by proposing changes, exchanging ideas and voting on requests from other users.

let's start uploading our project to github to share...

Initial Setup

To make Git ready for the first use, follow these steps:

git config --global user.name "Erfan Ramezani"
git config --global user.email "[email protected]"
git config --global core.editor "code --wait"
git config --global core.autocrlf input  # For Linux only

ssh implementation

ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub

enter the generated code in github

thanks Godlin Hilda J for this



First step

Due to have a repository in github first sign up or if you have one already just sign in . than choose + symbol on the right side and choose New repository

App Screenshot

  • than you should choose a name for your project . pay attention your project name would be your project directory or repository in your github profile.

Caution : According to recent github updated rule main branch you are working on was changed from Master to Main . as far as your default local system branch is Master , we may encounter some errors while pushing and pulling . therefore it is better to make Main as default branch on both git and github :

App Screenshot

  • (Dont create readme file unless you might rebase after adding your remote branch)

Second step : Uploading

Create a new directory or move to your project directory .open terminal and enter

  git init -b main
  • this would initialize git implementation on currunt direcory
  • -b main would make main as currunt working branch

To track all your file you should enter below code

  git add .

(optional) Or you could just upload some of your files than you would enter

git add <file-name>

Next step is to commit your changes

git commit -m 'all project files added'

Now it's time to add your github repository to remote branch

git remote add origin https://github.com/<repository name>

Aafter you added remote repository enter below command to confirm implementations

git remote -v
  • than you would see a text like this:

origin https://github.com/Erfan-ram/git-zero-tutorial.git (fetch)

origin https://github.com/Erfan-ram/git-zero-tutorial.git (push)



To finalize your goal and push your changes and files to github yo should enter :

git push -uf origin main

with Above you set your origin to track changes from main branch. than you would not need to specify which branch shoud push each time you enter git push

  • -u refers to --set-upstream
  • -f refers to skip errors and do thing automatically

You would see your files are being shared on your github repository . with every changes you just need these 3 commands :

git add .                               # add files to stage
git commit -m '< changes in codebase>'  # commit your changes
git push                                # send changed concepts to github

Than your all done.

About

This is a guide for anyone new to git and github . this is 2023 updated version and sync with new github changes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published