DEV Community

Pheak Pheasa
Pheak Pheasa

Posted on • Updated on

To init git on my directory to pull project from git repository.

  1. Install Git: Download and install Git from Git Downloads.

  2. Navigate to Your Project Directory: Open a terminal or command prompt and run:

    cd /path/to/your/directory
    
  3. Initialize Git: Run:

    git init
    
  4. Configure Git: Replace "Your Name" and "your.email@example.com" with your details:

    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
    
  5. Add GitLab Repository as Remote: Replace <repository_url> with the actual URL:

    git remote add origin <repository_url>
    

    If you need to edit:

    git remote set-url origin <repository_url>
  6. Pull from GitLab: Replace "master" with the branch name if needed:

    git pull origin master
    

    For private repositories, Git may prompt for your GitLab username and password.

  7. Optional: Check Remote Configuration: Run:

    git remote -v
    

    Verify that it shows the URL of your GitLab repository.

Top comments (0)