Git Stuff
Set Username and Password for git repo
The global git username and email address are associated with the commits on all repositories on your system that don’t have repository-specific values.
To set your global commit name and email address, run the git config command with the --global option:
git config --global user.name "Andrew Cockburn"
git config --global user.email "[email protected]"
Once done, you can verify that the information is correctly set by executing the following command:
The command saves the values in the global configuration file, ~/.gitconfig:
[user]
name = Your Name
email = [email protected]
You can also edit the file with your text editor, but it is recommended to use the git config command.
Setting Git Username and Email for a Single Repository
Sometimes, you may need to use a different username or email address for a specific repository. In that case, to set the identity, run the git config command without the --global option from within the repository directory.
Let’s assume you want to set a repository-specific username and email address for a repository located in the ~/Code/myapp directory. First, switch the repository root directory:
Set a Git username and email address:
git config user.name "Andrew Cockburn"
git config user.email "[email protected]"
Verify that the changes were made correctly:
The repository-specific settings are stored in the .git/config, located in the root directory of the repository.
!! info "References" https://linuxize.com/post/how-to-configure-git-username-and-email/
Save Username and Password in Git Credentials Storage
Run the following command to enable credentials storage in your Git repository:
To enable credentials storage globally, run:
When credentials storage is enabled, the first time you pull or push from the remote Git repository, you will be asked for a username and password, and they will be saved in ~/.git-credentials file.
During the next communications with the remote Git repository you won’t have to provide the username and password.
Each credential in ~/.git-credentials file is stored on its own line as a URL like:
Config Username and Password for Different Repositories
Sometimes you may need to use different accounts on the same Git server, for example your company’s corporate account on github.com and your private one. To be able to configure usernames and passwords for different Git repositories on the same Git server you can enable the useHttpPath option.
By default, Git does not consider the “path” component of an http URL to be worth matching via external helpers. This means that a credential stored for https://example.com/foo.git
will also be used for https://example.com/bar.git
. If you do want to distinguish these cases, set seHttpPath
option to true
Run the following commands to configure Git credentials storage and separate credentials for different repositories on github.com:
git config --global credential.helper store
git config --global credential.github.com.useHttpPath true
The usernames and passwords for different GitHub repositories will be stored in ~/.git-credentials file separately on their own lines:
https://<USERNAME>:<PASSWORD>@github.com/path/to/repo1.git
https://<USERNAME>:<PASSWORD>@github.com/path/to/repo2.git
References
https://www.shellhacks.com/git-config-username-password-store-credentials/ https://git-scm.com/docs/gitcredentials#Documentation/gitcredentials.txt-useHttpPath
Pull Pip Install From Remote Repository using SSH
pip install --force-reinstall git+ssh://[email protected]/home/dev/actools
--force-reinstall
used to remove the need for version bumps every time I make a change
This will:
- Clone the repo to a local temp directory
- Install dependencies
- Run a build
- Run the install
Warning
Works from comitted changes only