My Normal Commands
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------
git status
git add .
git commit -m "de""
git push -u origin
git pull origin
On Windows machine using gitbash
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------
ssh-add -l
eval $(ssh-agent -s)
ssh-add /c/UFK/github-saa-6sep2024
ssh-add -l
ssh -T
[email protected]git pull origin main
on ubuntu
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--------------------
ssh-add -l
eval $(ssh-agent -s)
ssh-add /home/umar-farooq/github-dell-laptop-14sep2024
ssh-add -l
ssh -T [email protected]
git push -u origin
## if using a new machine, and you have to generate a new key pair + upload public
key on github.com + clone it
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------
open terminal on ubuntu and go to any folder like cd ~
git --version
sudo apt update
sudo apt install git
ssh-keygen -t rsa -b 4096 -C "[email protected]"
ls -al
cat ~/.ssh/id_rsa.pub # Display your public SSH key by running, to display
your SSH key.
Copy the key and paste it into your GitHub account under Settings > SSH and GPG
keys.
eval "$(ssh-agent -s)" # Start the SSH agent:
ssh-add ~/.ssh/id_rsa # Add your SSH private key to the agent:
ssh-add -l # To confirm that the key has been added, run:
ssh -T [email protected]
git clone [email protected]:umarfarooqTkb/aws-solution-architect-associate.git
or
git clone https://github.com/umarfarooqTkb/aws-solution-architect-associate.git
Optional: Set SSH key for a specific repository (if needed):::
If you want to ensure a specific repository always uses the custom SSH key, you can
create or modify the ~/.ssh/config file to specify the key for GitHub:
Open the SSH configuration file (or create it if it doesn't exist):
bash
Copy code
nano ~/.ssh/config
Add the following configuration, pointing to your custom SSH key:
text
Copy code
Host github.com
HostName github.com
User git
IdentityFile ~/ssh_keys/id_rsa # Replace with your SSH key path
IdentitiesOnly yes
Save the file (Ctrl + O, Enter to confirm, Ctrl + X to exit).
-----------------------------------------------------------------------------------
-------------------------------------------------------------
login to your github account and Copy the Repository URL from GitHub
https://github.com/umarfarooqTkb/aws-solution-architect-associate.git # for https
[email protected]:umarfarooqTkb/aws-solution-architect-associate.git # for
SSH
-----
Using GIT_SSH_COMMAND
The GIT_SSH_COMMAND environment variable allows you to define the ssh command that
will be used during the Git operations that require SSH connections, such as git
clone, git fetch, git pull or git push.
You can set this environment variable to include the -i option, which allows you to
specify the path to the SSH private key that should be used.
Here's an example of how to use GIT_SSH_COMMAND when running git clone:
GIT_SSH_COMMAND="ssh -i /path/to/your/private/key" git clone
[email protected]:username/repo.git
Replace /path/to/your/private/key with the path to your SSH private key, and
replace
[email protected]:username/repo.git with the SSH URL of the repository you
want to clone.