I just need to bring up a git repo from scratch and push to github on a computer where there was initially
– NO git repo
– NO ssh keys to connect to github
So here are the straightforward steps:
1. Initializing git repo on the directory where you want:
git init
2. Adding all the files to the git repository:
git add .
3. First commit:
git commit -m "First commit"
4. Adding a remote repository:
git remote add origin [email protected]/funkydorian/ansible.git
5. You can check the effect of the previous step by:
cat .git/config
6. Check if you have ssh keys in order to connect to github:
ls ~/.ssh/id_rsa
7. If yes, check if you can connect to github:
ssh -T [email protected]
7. If not, create the keys:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
8. Add your private key identities to the authentication agent:
ssh-add ~/.ssh/id_rsa.pub
9. Copy the key to your clipboard:
pbcopy < ~/..ssh/id_rsa.pub
10. Login to your github.com from your browser
Settings –> SSH Keys –> Add Key –> Paste the content of id_rsa.pub
11. Create the repository on github.com
12. Check again if you can connect to github:
ssh -T [email protected]
You must see the output like:
"You've successfully authenticated…."
13. Try to push to github:
git push -v origin master