Skip to content

Shell command to add env var breaks if file ends in a comment #25721

Closed
@AlmostEfficient

Description

@AlmostEfficient

Code of Conduct

What article on docs.github.com is affected?

Step 7 on Tell Git about your signing key requires running this:

$ if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \
  else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi

This does not work if the user's .zshrc or .zprofile file ends in a comment. I recently installed pnpm so my .zshrc files ends with:

# pnpm end

What part(s) of the article would you like to see updated?

Update the commands in step 7 for Mac and Linux to add a linebreak before the export.

echo -e '\nexport GPG_TTY=\$(tty)'

This will change output from

# pnpm endexport GPG_TTY=$(tty)

to

# pnpm end
export GPG_TTY=$(tty)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions