Forum Discussion
AsimKhan2023
Feb 01, 2024Brass Contributor
Deploying code to GitHub via Azure DevOps Release Pipeline
Hi, I created an Azure DevOps project and in the repository I acquired the repo from GitHub, with PAT which worked perfectly and without any errors. I coded the project in Visual Studio 2022 and ...
AsimKhan2023
Feb 02, 2024Brass Contributor
The issue has been resolved and now the code has been pushed from Azure DevOps to GitHub repo.
I applied the following steps as guided:
Deleted the PAT from Azure DevOps and GitHub repo
Created a new PAT for both environments
Made copies of both PATs from the environments
Used the following script to make the release pipeline
script: |
Clone Azure DevOps repository
git clone https://<Azure-DevOps-PAT>@<Azure-DevOps-Repo-URL> MyRepo
Change into the cloned Azure DevOps repository directory
cd MyRepo
Add GitHub repository as a remote
git remote add github https://<GitHub-PAT>@<GitHub-Repo-URL>
Fetch changes from Azure DevOps to update local repository
git pull origin master --rebase
Reset local branch to the state of the Azure DevOps repository
git reset --hard origin/master
Push changes to GitHub repository with force to overwrite existing content
git push -u github master --force
displayName: ‘Copy Code to GitHub’
The script worked perfectly and the code from the Azure DevOps pushed to GitHub repo.
Regards,
Asim Khan
I applied the following steps as guided:
Deleted the PAT from Azure DevOps and GitHub repo
Created a new PAT for both environments
Made copies of both PATs from the environments
Used the following script to make the release pipeline
script: |
Clone Azure DevOps repository
git clone https://<Azure-DevOps-PAT>@<Azure-DevOps-Repo-URL> MyRepo
Change into the cloned Azure DevOps repository directory
cd MyRepo
Add GitHub repository as a remote
git remote add github https://<GitHub-PAT>@<GitHub-Repo-URL>
Fetch changes from Azure DevOps to update local repository
git pull origin master --rebase
Reset local branch to the state of the Azure DevOps repository
git reset --hard origin/master
Push changes to GitHub repository with force to overwrite existing content
git push -u github master --force
displayName: ‘Copy Code to GitHub’
The script worked perfectly and the code from the Azure DevOps pushed to GitHub repo.
Regards,
Asim Khan