Download and install Git. You can download Git from the official website: https://git-scm.com/downloads
Once Git is installed, open a terminal (or command prompt on Windows) and run the following command to configure your username and email:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Create a new directory for your project, and initialize it as a Git repository by running the following command:
git init
Add the files in your new directory to the repository, and commit the changes with a message:
git add .
git commit -m "Initial commit"
If you want to create a new repository on GitHub, go to the GitHub website and log in to your account. Then click on the "New repository" button.
Enter a name for your repository, and click "Create repository".
Follow the instructions on the page to push your local repository to the remote repository on GitHub.
That's it! You have now set up Git and pushed your first repository to GitHub.
Here are some useful Git commands that you can use to work with your repository:
git status: shows the status of your repository, including which files have been modified but not yet committed.
git diff
: shows the differences between the modified files and the previous version.
git add <file>
: adds the specified file to the staging area.
git commit -m "message"
: commits the changes in the staging area with a message.
git push
: pushes the commits to the remote repository.
git pull
: pulls the latest changes from the remote repository.
I hope this helps! Let me know if you have any questions.