set up git repository
Open your terminal.
Navigate to the root directory of your project using the
cd
command.Initialize a new Git repository by running the command
git init
. This initializes a new Git repository in the current directory.Use
git add .
to stage all the files in the current directory for commit. Alternatively, you can specify individual files or directories to stage.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.Create a new repository on a Git hosting service like GitHub or GitLab.
Copy the URL of the newly created repository.
Link your local repository to the remote repository by running
git remote add origin <repository_url>
. Replace<repository_url>
with the URL you copied.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.