$ git init
$ git add README MANIFEST README.pod LICENSE
$ git commit -m'Initial Commit'
$ git remote add github [email protected]:youruserid/Your-Prj.gitI would use:
$ git remote add github [email protected]:vkeselj/App-Utils.gitbecause I use a separate ssh key for GitHub.
$ git push -u github master
$ git add -u # add modified tracked filesand use again
git commit
and git push
as above
to push changes.
$ git remote add github [email protected]userid:userid/My-Prj.gitrather than the standard:
$ git remote add github [email protected]:userid/My-Prj.git
This is done so that we can use a dedicated SSH key for GitHub, rather than
our default SSH key. In order to make this work, we need to use the command
ssh-keygen
to generate a separate private-public key pair in
the directory .ssh
, named for example as id_rsa-github
and id_rsa-github.pub
.
We then edit the file ~/.ssh/config
to contain:
Host github.com-userid HostName github.com User git IdentityFile ~/.ssh/id_rsa-githuband then whenever we access host
github.com-userid
via SSH
or git as in the command above, the appropriate key will be used.
We also need to make sure that this public SSH key is uploaded to GitHub in our account.