To start your first project on GitHub, create a new repository, optionally add a README file, and then link your local project to this repository using Git. This allows you to track changes and collaborate on your project with others.
Here's a step-by-step guide:
-
Create a New Repository on GitHub:
Go to GitHub and log in to your account.
Click the "+" icon in the top right corner and select "New repository". Give your repository a name (e.g., "my-first-project"), add an optional description, and choose whether it will be public or private. Optionally, initialize the repository with a README file, .gitignore, or a license. Click "Create repository".
-
Link Your Local Project:
If you have an existing local project: Open your terminal or command prompt, navigate to your project's directory, and use the following Git commands: git init to initialize a local Git repository.
git add . to stage all files for the first commit. git commit -m "Initial commit" to commit the changes with a message. git remote add origin <repository_URL> to add the remote repository. git push -u origin main to push your local changes to the remote repository (replace main with your branch name if different).
If you are starting a new project: You can clone the newly created GitHub repository locally using git clone <repository_URL>.
-
Working with Your Project:
After linking your local project, you can use Git commands like git add, git commit, and git push to manage your project's files and changes.
You can also use GitHub Desktop or other Git clients to interact with your repository.