Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Git Pull Script — Repo Secrets Update Guide (DEV Environment)
#1
Photo 
================================================================================
        Git Pull Script — Repo Secrets Update Guide (DEV Environment)
================================================================================


================================================================================
OVERVIEW
================================================================================

This guide explains the process for updating repository credentials (repo secrets)
used in the automated git pull script running via cron jobs.

================================================================================
ISSUE
================================================================================
Developers' code changes are not getting updated in the DEV environment.

Root cause is usually:
- Expired / invalid repository credentials
- Git pull cron job failing due to authentication issues

================================================================================
STEP-BY-STEP PROCEDURE
================================================================================

--- Step 1: Login to DEV Server (Linode) ---
Login to the DEV server using SSH.

================================================================================

--- Step 2: Identify the Application Container ---
All projects are running inside Docker containers.

Code:
docker ps -a

Find the appropriate container for your application.

================================================================================

--- Step 3: Access the Container ---
Exec into the application container:

Code:
docker exec -it <container_name> bash

================================================================================

--- Step 4: Locate Git Pull Cron Job ---
Check existing cron jobs:

Code:
crontab -l

Also check system cron directory:

Code:
ls -l /etc/cron.d/

Look for file:
git-pull-cron

================================================================================

--- Step 5: Verify Cron Script and Logs ---
Read the cron configuration:

Code:
cat /etc/cron.d/git-pull-cron

Check logs for failures:

Code:
cat /var/log/git-pull.log

? If logs show authentication errors → credentials need update.

================================================================================

--- Step 6: Update Git Credentials ---
Open the git pull script:

Code:
vi /usr/local/bin/git-pull.sh

Replace old credentials with new ones.

================================================================================

--- Step 7: Generate New Repo Credentials (Azure DevOps) ---

1. Login to Azure DevOps
2. Navigate to the appropriate project
3. Open the required repository
4. Click on **Clone**

Reference:
https://prnt.sc/X5RGff0Z8pLG

5. Click on **Generate Credentials**

Reference:
https://prnt.sc/FA7t5X-oPgge

6. Copy the generated credentials

================================================================================

--- Step 8: Update Script with New Credentials ---

Update credentials in:

Code:
/usr/local/bin/git-pull.sh

Reference:
https://prnt.sc/BSdafqM5zDdk

Save the file.

================================================================================

--- Step 9: Re-run Script and Verify ---

Manually execute the script:

Code:
bash /usr/local/bin/git-pull.sh

Check logs:

Code:
cat /var/log/git-pull.log

Ensure:
- Git pull is successful
- No authentication errors

================================================================================
TROUBLESHOOTING
================================================================================

--- Git pull still failing ---
- Verify credentials are correct
- Ensure repo URL is correct
- Check network connectivity

--- Cron not running ---
Code:
systemctl status cron

--- Permission issues ---
Code:
chmod +x /usr/local/bin/git-pull.sh

================================================================================
QUICK SUMMARY
================================================================================

Issue: Code not updating in DEV 
Cause: Expired repo credentials 
Fix: Update credentials in git-pull script 

Key Files:
- /etc/cron.d/git-pull-cron
- /usr/local/bin/git-pull.sh
- /var/log/git-pull.log

================================================================================
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)