Wrapper for Git on Ubuntu-20.04.
Ideally create ~/bin if it doesn't exist.
- The next time you logoff/login your $PATH variable will be updated to search in ~/bin.
mkdir ~/bin
exit
<login>
What is $PATH?
Clipped from man bash
PATH
The search path for commands. It is a colon-separated list of directories
in which the shell looks for commands (see COMMAND EXECUTION below).
A zero-length (null) directory name in the value of PATH indicates the current directory.
A null directory name may appear as two adjacent colons, or as an initial or trailing colon.
The default path is system-dependent, and is set by the administrator who installs bash.
A common value is ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
See here for details on setting custom $PATH directories.
To verify your $PATH has been updated with /home/$USER/bin run the command below
- Your full $PATH variable should be returned, otherwise
grep
exits on error.
env | grep "^PATH=.*:$HOME/bin:.*$"
cd ~/bin || cd /usr/bin # Optional
git clone https://github.com/carv-cmd/gitbash.git
Create the symbolic link $PATH/gitman -> gitbash/gitman.sh.
- Depending where you cloned gitbash, fill in $GITBASH_LOCATION respectively.
# Change into $PATH/directory
cd ~/bin || cd /usr/bin || cd /$DIR_ON_PATH
# ln -s <resource_path> <link_name>
ln -s $GITBASH_LOCATION/gitbash/manager.sh gitman
# See `gitman` features
gitman help
- Try:
gitman <subcmd> --help
Subcommand | Files | Description |
---|---|---|
gitman users |
users.sh |
Git user setup & basic configuration |
gitman repo |
repo.sh |
(Create,Push) remote Git repositories |
gitman branch |
branch.sh |
Create, merge, and delete branches |
gitman commit |
commit.sh |
Wrapper for git add-commit-push |
gitman upstream |
upstream.sh |
Query upstream repositories |
This is not required to push/pull/commit/branch/etc with clones over ssh.
gh
is required if you want to create repos locally and push those repos upstream.
To install the gh-cli
, simply run the following commands.
- Please note this is only tested on Ubuntu20.04.
# Echo commands if '--run' omitted
gitman install-gh-cli [--run]
gh --help
Please read GIT-SSH.md for details on setting up SSH w/ GitHub.
- Running
gitman users --keygen
creates an ssh-key-pair and prints the public key to upload. - See here, for details on adding keys to your GitHub account.
# Test setup with
ssh -T gh
If you plan to use the gh
CLI you need a PAT.
That token needs the following scopes: repo, admin:org, and gist
- Be sure to save the token (secure temporary place) as its only shown once, although they're easy to regenerate.
- Create one here (must be logged in to github)
- For more details about the PAT formats, see here
Add token to your ~/.bashrc
file with the following:
# Token should start with 'ghp_*'.
TOKEN="ghp_<new_token>"
echo "export GH_TOKEN=$TOKEN" >> ~/.bashrc
# Apply changes to current environment
source ~/.bashrc
# Test authentication
if ! gh auth status; then
env | grep GH_TOKEN
fi
# Update $GH_TOKEN
sed [-i] "s/^export GH_TOKEN=.*$/export GH_TOKEN=$TOKEN/" ~/.bashrc