remote

Adding an existing project to GitHub

These are useful links to help create an SSH certificate and upload your public key to your GitHub account.

Set up SSH certificate

Add an existing project to GitHub

Create the remote repository (origin)

Execute the following commands to add and commit your changes.

git add .

git commit -m "Initial commit"

Then add the remote and push.

git remote add origin git@github.com:controlcode/perl.git

git push -u origin master

The -u or --set-upstream option sets an upstream tracking reference. This is used by commands such as git pull that don't use arguments.

Rich@RICH-PC ~/workspace/perl (master)

$ git push -u origin master

Enter passphrase for key '/c/Users/Rich/.ssh/id_rsa':

Counting objects: 4, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (4/4), 481 bytes | 0 bytes/s, done.

Total 4 (delta 0), reused 0 (delta 0)

To git@github.com:controlcode/perl.git

* [new branch] master -> master

Branch master set up to track remote branch master from origin.

Before upstream tracking is set...

Rich@RICH-PC ~/workspace/perl (master)

$ git branch -vv

* master d0c57af Initial version.

and after...

Rich@RICH-PC ~/workspace/perl (master)

$ git branch -vv

* master d0c57af [origin/master] Initial version.

If you forget to automatically track the upstream branch, you can set this manually.

git branch --set-upstream-to=origin/master