# gpm logout

Clear your authentication token from the local configuration.

## Usage

```bash
gpm logout [--registry <url>]
```

## Flags

| Flag               | Description                 | Default     |
| ------------------ | --------------------------- | ----------- |
| `--registry <url>` | Registry URL to logout from | From config |

## Description

The `gpm logout` command removes your authentication token from the local configuration, effectively signing you out from the GPM registry. This command clears stored credentials for the specified registry or all registries if no specific registry is provided.

### What Gets Cleared

* **Authentication Token**: Removes stored token from secure storage
* **Registry Configuration**: Keeps registry URL but removes authentication
* **User Session**: Ends current authenticated session

### Secure Storage Cleanup

GPM removes authentication tokens from:

* **macOS**: OS Keychain
* **Linux**: OS Keychain (if available) or encrypted file
* **Windows**: Windows Credential Manager or encrypted file

## Examples

### Basic Logout

```bash
# Logout from default registry
gpm logout
```

### Specific Registry

```bash
# Logout from specific registry
gpm logout --registry https://company.gpm.sh
```

## Output

### Successful Logout

```
Logged out successfully
─────────────────────
Registry: https://registry.gpm.sh
Token removed from secure storage
─────────────────────
You are now logged out from the registry
```

### No Authentication

```
No authentication found
───────────────────────
Registry: https://registry.gpm.sh
No stored credentials to remove
───────────────────────
You are already logged out
```

## Registry-Specific Logout

### Global Registry

```bash
# Logout from global registry
gpm logout --registry https://registry.gpm.sh
```

### Tenant Registry

```bash
# Logout from tenant registry
gpm logout --registry https://company.gpm.sh
```

## Security Considerations

### Token Removal

* Tokens are completely removed from secure storage
* No traces of authentication remain locally
* Registry URL configuration is preserved

### Re-authentication

After logout, you'll need to run `gpm login` again for operations requiring authentication:

```bash
# Operations requiring authentication after logout
gpm publish --access=private
gpm publish --access=scoped
```

## Error Handling

### Common Scenarios

* **No authentication found**: Informational message, not an error
* **Storage access denied**: Permission error when removing token
* **Registry not found**: Invalid registry URL specified

### Troubleshooting

1. **Permission denied**: Check keychain/file system permissions
2. **Registry not found**: Verify registry URL is correct
3. **Storage error**: Check available disk space and permissions

## Related Commands

* [`gpm login`](/cli-reference/cli/authentication/login.md) - Sign in to registry
* [`gpm whoami`](/cli-reference/cli/authentication/whoami.md) - Check current authentication status
* [`gpm config`](/cli-reference/cli/configuration/config.md) - Manage configuration settings

## See Also

* [Authentication Overview](/cli-reference/cli/authentication.md)
* [Security Best Practices](https://github.com/gpm-sh/docs/blob/main/troubleshooting/common-issues.md#security)
* [Registry Configuration](https://github.com/gpm-sh/docs/blob/main/packages/registry-resolution.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gpm.sh/cli-reference/cli/authentication/logout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
