GitLab
Configuring the Gitlab in windows terminal and pulling and pushing the code from local Machine to remote Repository of Gitlab.
the steps to configure GitLab in the Windows command prompt and to pull and push code to a remote repository.
Configuring GitLab in Windows CMD Terminal
Install Git:
Download and install Git from git-scm.com)).
During installation, ensure you select the option to use Git from the command line and also from 3rd-party software.
Generate SSH Keys:
Open the command prompt and run the following command to generate an SSH key pair:
ssh-keygen -t ed25519 -C "your_email@example.com"When prompted, press Enter to accept the default file location and enter a passphrase if desired.
Add SSH Key to SSH Agent:
Start the SSH agent in the backgroundStart the SSH agent in the background:
eval $(ssh-agent -s)Add your SSH private key to the SSH agent:
ssh-add ~/.ssh/id_ed25519
Add SSH Key to GitLab:
Copy the SSH public key to your clipboard:
clip < ~/.ssh/id_ed25519.pub
Log in to your GitLab account, go to User Settings > SSH Keys, and paste the key.
Configure Git:Set your Git username and email:
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Pulling and Pushing Code to Remote Repository
Clone the Repository:
Open the command prompt and navigate to the directory where you want to clone the repository.
Use the following command to clone the repository:
git clone git@gitlab.com:username/repository.git
Replace username/repository.git with your actual GitLab repository path.
Make Changes and Commit:
Navigate to the cloned repository directory:
cd repository
Make changes to your files.
Add the changes to the staging area:
git add .
Commit the changes:
git commit -m "Your commit message"
Push Changes to Remote Repository:
Push the changes to the remote repository:
git push origin master
Replace master with the name of your branch if you are working on a different branch.
Pull Changes from Remote Repository:
To pull the latest changes from the remote repository:
git pull origin masterAgain, replace master with your branch name if necessary.


0 Comments