Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change repository of the existing app? #288

Closed
jimmyn opened this issue Dec 3, 2019 · 28 comments
Closed

How can I change repository of the existing app? #288

jimmyn opened this issue Dec 3, 2019 · 28 comments
Labels
archived This issue has been locked. question Further information is requested

Comments

@jimmyn
Copy link

jimmyn commented Dec 3, 2019

** Please describe which feature you have a question about? **
We have an app connected to Bitbucket repo. We are migrating to GitHub private repo. If it possible to update a source repo of the existing app?

I've tried to update the app using aws cli

aws amplify update-app --app-id AMPLIFY_APP_ID --repository https://github.com/microapps/private-repo.git --access-token GITHUB_ACCESS_TOKEN

But I get this error:

Error parsing parameter '--repository': Unable to retrieve https://github.com/microapps/private-repo.git: received non 200 status code of 301
@jimmyn jimmyn changed the title How can I change repository of the existing app How can I change repository of the existing app? Dec 3, 2019
@swaminator
Copy link
Contributor

@jimmyn there's no way of changing the repo for an app. A workaround is to duplicate the app using aws amplify get-app and then use those settings to create an app using aws amplify create-app.

@swaminator swaminator added the question Further information is requested label Dec 3, 2019
@jhoffmcd
Copy link

Seems odd that aws amplify update-app has a --repository argument available to it if we can't use it :(

@DanielWFrancis
Copy link

This is kind of infuriating btw

@sebmellen
Copy link

Would be great if this were possible. Has caused a lot of issues with domain management — constantly having to recreate apps is not a good UX. Netlify does this better.

@bwalsh
Copy link

bwalsh commented Jun 13, 2020

disappointing

@twinmind
Copy link

@swaminator I'm not sure why this issue was closed and no explanation has been given on why it's impossible to support such seemingly simple functionality.

@NomanGul
Copy link

NomanGul commented Jul 21, 2020

we can change it by using the Amplify Console UI.

  1. go to the Amplify console General page
    image

  2. click on Reconnect repository
    image

  3. It'll reload the page and show you the change/reconnect repository modal. (It's a little buggy and take some time to show the popup)
    image

  4. change the repository and It's done 💯

@sanodo
Copy link

sanodo commented Aug 12, 2020

this doesn't allow you to change to a different git provider/account. is there a way to do that?

@hsspain
Copy link

hsspain commented Aug 24, 2020

The AWS CLI command outlined above will change an Amplify app's source repository provider/account along with the URL:

aws amplify update-app --app-id AMPLIFY_APP_ID --repository REPOSITORY_URL --access-token ACCESS_TOKEN

Please keep in mind that the --access-token expectations are different for each of the providers as they handle authentication differently.

@MatteoInfi
Copy link

we can change it by using the Amplify Console UI.

  1. go to the Amplify console General page
    image
  2. click on Reconnect repository
    image
  3. It'll reload the page and show you the change/reconnect repository modal. (It's a little buggy and take some time to show the popup)
    image
  4. change the repository and It's done 100

Umm, nope, it is still showing the old one

@jamesjessian
Copy link

aws amplify update-app --app-id AMPLIFY_APP_ID --repository REPOSITORY_URL --access-token ACCESS_TOKEN

... worked for me, transferring from one github account to another github account and repo. I know it's not quite what the OP was doing, but thought it may be worth noting that:

  • The AMPLIFY_APP_ID is the last bit of the app ARN (e.g. dXXXXXXXXXXXXX)
  • For github repositories, the access token is a Personal Access Token (https://github.com/settings/tokens).
  • I gave it all of the repo and admin:repo_hook privileges.
  • That had to be created from the repository owner's account, not a contributor.

@Jupdi
Copy link

Jupdi commented Dec 2, 2020

Did anyone managed this with Bitbucket Cloud where you cannot generate access token? I tried to get a token when connecting another app but getting an error:

An error occurred (BadRequestException) when calling the UpdateApp operation: There was an issue setting up your repository. Please try again later.(Invalid Authorization header)

@FelixRe0
Copy link

FelixRe0 commented Dec 16, 2020

@MatteoInfi

Umm, nope, it is still showing the old one

You need to grant org access to OAuth Apps:
(Sorry for the ugly writing)

image
image

Also you might need to delete old webhooks from the repository.

@Jupdi
Copy link

Jupdi commented Dec 16, 2020

Well i now did it a really easy way. You just need to delete all your frontend enviroments. Then you can change the Repo and add them again with the existing backend.

@oscarnevarezleal
Copy link

oscarnevarezleal commented Dec 19, 2020

The current behavior is extremely buggy. I transferred my repository from my personal account to an organization, when I wanted to do this using the Amplify UI, the Reconnect repository button just kept spinning without allowing me to do any change.

I don't know what exactly did the trick but here's what I tried and end up working allowing me to modify the repository.

Remove any manual environment created on the Amplify UI
Make sure the Oauth Application has been granted access to your repo
Make sure the Access Token can read repos and also have webhook permissions
Try to run the update command line, at this point I was getting a diferent error "An error occurred (BadRequestException) when calling the UpdateApp operation: There was an issue setting up your repository. Please try again later."
I came back to the Amplify UI page and a this point I was able to reconfigure the repository again.

@mcbergsma
Copy link

I just migrated my repo from a private account to an organization account and it worked, the only hang-up was not paying more attention to the popup in Amplify when reconnecting. This is what I did.

  1. Transfer the repo to the new account
  2. In the new repo, go to Settings / Webhooks and delete the Push hook to Amplify **This is what I failed to do
  3. In the Amplify Console, go to App Settings / General, click Reconnect Repository
  4. Log into your git Account and authorize your Organization if not already done
  5. You should see the new repo as Org/RepoName, choose that one and after a few seconds of processing it's connected (and will have added a new webhook to the repo to replace the one you deleted in step 2)

@MartinCura
Copy link

2. In the _new_ repo, go to Settings / Webhooks and delete the Push hook to Amplify **This is what I failed to do

This made it work for me in the AWS Amplify Console, thanks @mcbergsma !

@VitDev17
Copy link

Hi everyone,
I don't know if this bug is still a thing but i solved the problem by deleting all the branches.
This will give you the possibility of adding another repository from scratch.
ATTENTION! If you have custom build settings in the build settings, save them in the notes and paste them back because with this operation they will be cleared.

@krry
Copy link

krry commented Jun 1, 2022

aws amplify update-app --app-id AMPLIFY_APP_ID --repository REPOSITORY_URL --access-token ACCESS_TOKEN

... worked for me, transferring from one github account to another github account and repo. I know it's not quite what the OP was doing, but thought it may be worth noting that:

  • The AMPLIFY_APP_ID is the last bit of the app ARN (e.g. dXXXXXXXXXXXXX)
  • For github repositories, the access token is a Personal Access Token (https://github.com/settings/tokens).
  • I gave it all of the repo and admin:repo_hook privileges.
  • That had to be created from the repository owner's account, not a contributor.

In my case, I needed to update the repository name, for which Amplify doesn't yet provide a GUI. But this CLI command worked like a charm, even on an org (which I admin). Thanks @jamesjessian!

@SamiHK
Copy link

SamiHK commented Jun 23, 2022

@hsspain comment solved the problem - though AWS should be allowing us to configure apps to new repositories.

@wezside
Copy link

wezside commented Jul 22, 2022

Anyone know how I can migrate or update (without deleting branches) from Gitlab to CodeCommit? The update gives me the error below.

aws amplify update-app --app-id $appid$ --repository ssh://git-codecommit.*.amazonaws.com/v1/repos/$reponame$ --profile $profile$

An error occurred (BadRequestException) when calling the UpdateApp operation: Repository provider not supported.

@seantcanavan
Copy link

seantcanavan commented Jul 28, 2022

I just deleted the app and re-built it. The issue I had is that I renamed the repository and GitHub does destructive renames. That is, they change the name, url, everything when you change the name of the repo. This causes references to the old repo not to work including the hard coded value in AWS amplify.

@wezside
Copy link

wezside commented Jul 28, 2022

@seantcanavan I ended up removing all the hosting environments but keeping the app and backend environments. Then when I chose Connect Branch I was able to use the new provider.

@hitchiceburg
Copy link

hitchiceburg commented Jul 29, 2022

In "General" , scroll down there is a Branches section with a "Connect a branch" button.

@satyadeepk
Copy link

satyadeepk commented Aug 19, 2022

When I am trying to change my repository provider from Gitlab to Github, I get the following error.

Error parsing parameter '--repository': Unable to retrieve https://github.com/org/repo: received non 200 status code of 404

I am trying with a personal access token. It's a private repo in an organization of which I am an owner. Any help is appreciated!

@medinatochiajro-metergram

@Jupdi I am not being able to make it work the way that you have mentioned. When I am trying to connect to Bitbucket it won't allow me to connect to the repo

@ThatSameer
Copy link

I updated my repos name, which "orphaned" my Amplify app with no straightforward way of reconnecting. So instead I went to "General" and under Branches I disconnected the branch, which in return deleted the application but kept the shell to the app (keeping its domain management settings etc) and then connected the new repo. Existing settings remain but had to delete and recreate. Hope this helps.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label Oct 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. question Further information is requested
Projects
None yet
Development

No branches or pull requests