Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM as Cloud : Pushing code from GIT to Cloud Repo

Avatar

Level 4

Is it possible to remote push from Git repo to Cloud repo, if the branch names are not same.

 

Want to push from GIT to CLOUD repo

Git repo branch name :- develop

Cloud repo branch name :- uat

 

Tried using 

git push https://git.cloudmanager.xxx.com/XXXX develop:uat

 

Error :-

(non-fast-forward)
error: failed to push some refs to 'https://git.cloudmanager.xxx.com/xxxx '
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes.

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

git push cloudurl develop:uat -f

 

uat branch will be overrided with develop branch code

View solution in original post

6 Replies

Avatar

Community Advisor

@maheshp 

 

Below commands should help you to push to remote 

 

Git remote -v

Git remote add bitbucket https;//${USERID}:${PASSWORD}@bitbucket url

Git checkout -f branch name

Git remote -v

Git push bitbucket branch name:branch name

Avatar

Community Advisor

 

1.Clone your git repo on local machine 

2. Add remote repo to it via remote add command "git remote add <remote-repo>"

3.Now checkout the branch from your git repo which you want to push and use below command to push in remote repo


git push <local_branch_name>:<desired_remote_branch_name>

Himanshu Jain

Avatar

Level 7

Instead of doing it every time manually you should set up automated process to sync from your repo to Adobe Cloud Repo.

In these cases an automated synchronization process should be setup to ensure that Cloud Manager’s Git repository is always kept up to date. Depending on where the customer’s Git repository is hosted, a GitHub action or a continuous integration solution like Jenkins could be used to setup the automation. With an automation in place, every push to a customer owned Git repository can be automatically forwarded to Cloud Manager’s Git repository.

Refer here for more details - https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/managing-code/...

 

This will help you in long term. And you dont need to worry about manual steps. 

Avatar

Level 4

We do not want to set up automated sync for this particular branch on Cloud, and this has to be updated only after specific sign-offs hence needs to be manual via command.

Any idea what could be going wrong here while we are trying to sync via git command

Avatar

Correct answer by
Community Advisor

git push cloudurl develop:uat -f

 

uat branch will be overrided with develop branch code