Translate

GitHub learning

 

Step 1: Install Git on Your PC

1) Go to Git official web site DOWNLOAD [https://git-scm.com/downloads]

2) Choose you OS and install, I'll do for window.

3) Use default settings until you have any specific requirement.

4) To use command line please ensure that GIT BASH is also installed.

 

Step 2: Configure Git (First-Time Setup)

Open Git Bash and run:

git config --global user.name "Your Name"

git config --global user.email "your-GIT-email@example.com"

 

Note: -Regarding name and email it can be anything, Git doesn’t enforce that they match your GitHub account. These values are just used to label your commits on Git. Your commits will only be linked to your GitHub profile if you use Git hub registered email. If you want to keep your mail secure then you can also use no reply email, you can see this email on your git hub profile.


Example: git config --global user.email "yourusername@users.noreply.github.com"

 


Step 3: Move to project folder


  1.  Navigate to your project folder like cd  /C/DATA/RK/01.PythonRepo.
  2.  Please remove colon ":" from path and replace back slash "\" to forward slash "/". After updating path use cd to navigate to project folder.

 

Step 4: Get ready to add /commit and PUSH. Use following commands

rm -rf .git                  

git init

git add .

git commit -m "First check in on Git"

git branch -M main

 

Note- below 2 commands will get run under step 6.

 

git remote add origin https://github.com/rakeshRepo/PythonRepo.git

git push -f origin main

 

Step 5: Create a GitHub Repository

- Go to GitHub.com and log in.

- Create New Repository and give it required name.

- Choose Public or Private as you need and click Create.

 

Step 6: Copy the HTTPS URL of your new repo

(e.g. https://github.com/rakeshRepo/PythonRepo.git). 
- Now update it in below command before running in bash.
         git remote add origin https://github.com/rakeshRepo/PythonRepo.git
 
- Now last step is to push code using below command. Only after executing below command your code will appear on Git UI.

         git push -f origin main

 

Step 7: Regular use command :

Above steps are one time activity. During regular development whenever you'll make code changes use below commands 

git add .

         git status  

git commit -m "Your message related to the code changes"

git push -f origin main

 

No comments:

Post a Comment

Popular Posts