set up git repository

  1. Open your terminal.

  2. Navigate to the root directory of your project using the cd command.

  3. Initialize a new Git repository by running the command git init. This initializes a new Git repository in the current directory.

  4. Use git add . to stage all the files in the current directory for commit. Alternatively, you can specify individual files or directories to stage.

  5. Commit the staged files with a descriptive message using the command git commit -m "Initial commit". This creates a new commit with the changes you staged.

  6. Create a new repository on a Git hosting service like GitHub or GitLab.

  7. Copy the URL of the newly created repository.

  8. Link your local repository to the remote repository by running git remote add origin <repository_url>. Replace <repository_url> with the URL you copied.

  9. Push your initial commit to the remote repository using git push -u origin master. This uploads your local changes to the remote repository.

Now your Ruby project is set up with a Git repository, and you can continue to commit and push changes as needed.