pipeline {
    agent any

    stages {
        stage('start') {
            steps {
                script {
                     withCredentials([usernamePassword(credentialsId: 'root', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
                     
                        sh 'git config --global user.email "jenkins@example.com"'
                        sh 'git config --global user.name "jenkins"'

                        sh "git remote set-url origin http://${USER}:${PASS}@127.0.0.1:8081/root/markatty.git"
                        sh 'git add .'
                        sh '''git commit -m "Pushing version no. $BUILD_NUMBER" '''
                        sh 'git push -u origin main' }
                }
            }
        }
    }
}