Git_Setup
Git_Setup
Worksheet No - 04
Student Name: Keshav Kumar UID: 23MCA20462
Branch: MCA Section: 23MCA-8A
Semester : III DOP : 09/09/2024
Subject Name: Back-end technology Subject Code: 23CAH-705
Aim:
To understand and implement the steps to attach a project to Git and push it to a GitHub repository,
ensuring proper version control and code management.
1. Materials Required:
● VS Code (or any text editor with Git integration)
● Git installed on your system
● GitHub account
2. Implementation Steps:
● Create a New Project or Open an Existing Project:
● Create a GitHub Repository:
○ Log into your GitHub account.
○ Click on the "New" button to create a new repository.
○ Enter a repository name and description (optional).
○ Choose whether to make the repository public or private.
○ Click "Create repository".
○ Copy the repository’s URL from the generated page.
● Initialize Git in the Project Folder:
○ In VS Code, open the terminal (Ctrl + backtick or Terminal > New Terminal).
● Run the following command to initialise Git in your project folder:
→ git init
● Add Files to Staging:
Add all the files in your project to Git's staging area, which prepares them to be committed:
→ git add .
● Commit the Changes:
After staging the files, commit them with a meaningful message:
→ git commit -m "Your Comments about the project"
● Connect the Local Repository to GitHub:
Connect your local Git repository to the remote GitHub repository using the URL you copied
earlier:
→ git remote add origin https://github.com/keshavgangwar/Conversa.git
● Rename the Branch to 'main':
Ensure your branch name is main (as master was traditionally used but is now often replaced by
main):
→ git branch -M main
● Push the Code to GitHub:
Push your local project to the GitHub repository:
→ git push -u origin main
Output:-
Learning Outcomes:
1. Understand how to initialise a Git repository for a local project.
2. Learn the basic Git commands (git init, git add, git commit, git remote add, and
git push).
3. Know how to create and connect a GitHub repository to a local Git project.
4. Gain the ability to push code from your local machine to GitHub using VS Code.
5. Be familiar with managing branches in Git, such as renaming from master to main.
6. Understand the benefits of version control and using GitHub for project management and
collaboration.
Signature………………