diff --git a/src/components/git-sync/steps/SyncStepError.tsx b/src/components/git-sync/steps/SyncStepError.tsx
new file mode 100644
index 00000000..6978a11b
--- /dev/null
+++ b/src/components/git-sync/steps/SyncStepError.tsx
@@ -0,0 +1,145 @@
+import { Errors as GitErrors } from 'isomorphic-git';
+import { AlertTriangle, X, ArrowDown } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Alert, AlertDescription } from '@/components/ui/alert';
+
+interface SyncStepErrorProps {
+ error: Error;
+ onDismiss: () => void;
+ onForcePull: () => void;
+ onPull: () => void;
+}
+
+export function SyncStepError({ error, onDismiss, onForcePull, onPull }: SyncStepErrorProps) {
+ const renderForcePullButton = () => (
+
+ );
+
+ const renderDismissButton = () => (
+
+ );
+
+ // MergeNotSupportedError - offer force pull
+ if (error instanceof GitErrors.MergeNotSupportedError) {
+ return (
+
+
+
+
+ Cannot merge changes automatically. Your local changes conflict with the remote repository.
+
+ {renderDismissButton()}
+
+ {renderForcePullButton()}
+
+
+ );
+ }
+
+ // FastForwardError - offer force pull
+ if (error instanceof GitErrors.FastForwardError) {
+ return (
+
+
+
+
+
+ Cannot fast-forward. The remote has changes that conflict with your local commits.
+
+ {renderDismissButton()}
+
+ {renderForcePullButton()}
+
+
+ );
+ }
+
+ // PushRejectedError - remote has changes
+ if (error instanceof GitErrors.PushRejectedError) {
+ return (
+
+
+
+
+
+ Push rejected. The remote repository has changes you don't have locally. Try pulling first.
+
+ {renderDismissButton()}
+
+
+
+ {renderForcePullButton()}
+
+
+
+ );
+ }
+
+ // HTTP errors
+ if (error instanceof GitErrors.HttpError) {
+ let message: string;
+
+ switch (error.data.statusCode) {
+ case 401:
+ message = 'Authentication failed. Please check your credentials.';
+ break;
+ case 403:
+ message = 'Access forbidden. You do not have permission to access this repository.';
+ break;
+ default:
+ message = `HTTP Error: ${error.data.statusCode} ${error.data.statusMessage}`;
+ }
+
+ return (
+
+
+
+
+ {message}
+
+ {renderDismissButton()}
+
+
+ );
+ }
+
+ // Generic error fallback
+ return (
+
+
+
+
{error.message}
+ {renderDismissButton()}
+
+
+ );
+}