I am using Git on Windows 10 via git bash. I have a couple of projects locally that I want to push to different GitHub repositories.
This is my gitconfig -
[user]
name = my-name
email = my-email@gmail.com
[remote "origin"]
url = git@github.com:my-name/terraform_lambda_implementation.git
proxy = http://proxy.XXXXX.net:port
[http]
sslBackend = openssl
sslCAInfo = " C:\\Users\\username\\Downloads\\proxy.pem"
sslverify = false
[core]
editor = notepad++.exe -multiInst -nosession
[merge]
tool = p4merge
[mergetool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
[mergetool]
prompt = false
[diff]
tool = p4merge
[difftool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
[difftool]
prompt = false
[alias]
hist = log --all --graph --decorate --oneline
[remote "ml"]
url = git@github.com:my-name/data_science_ML.git
[remote "testpush"]
url = git@github.com:my-name/test_push.git
I have a proxy because I am behind a corporate firewall. I am using PyCharm for my local development. I have added my github account to the PyCharm version control.
I have created separate SSH keys fro each project and I have added them as deploy keys with write access in the respective github repos.
When I try to push from my local -
git push ml master
I get the below error -
ERROR: Permission to my-name/data_science_ML.git denied to deploy key
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I get the same issue when I try to push the other project.
When I run git remote show origin from the respective projects I get this -
from origin project -
* remote origin
Fetch URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/terraform_lambda_implementation.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
from ml project -
* remote origin
Fetch URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/data_science_ML.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (local out of date)
from testpush project -
* remote origin
Fetch URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/terraform_lambda_implementation.git
Push URL: git@github.com:my-name/test_push.git
HEAD branch: master
Remote branch:
master new (next fetch will store in remotes/origin)
Local ref configured for 'git push':
master pushes to master (local out of date)
I have added the SSH keys in the ~/.ssh/config -
# ~/.ssh/config
Host git@github.com:my-name/terraform_lambda_implementation.git
HostName github
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Host git@github.com:my-name/data_science_ML.git
HostName github
User git
IdentityFile ~/.ssh/ds_rsa
IdentitiesOnly yes
Host git@github.com:my-name/test_push.git
HostName github
User git
IdentityFile ~/.ssh/test_push_rsa
IdentitiesOnly yes
What am I doing wrong?