This post is going to illustrate how you can easily configure and set up your github repository on Ubuntu
Prerequisite
- The repository exists ( mine is https://github.com/sebastianoc/sebba-scripts )
- You have a ssh key agent on the Ubuntu server or Pageant on your Windows machine, I use a Window machine to connect to the Ubuntu server and Pageant forward my ssh keys.
Installation
Clone the repository
ubuntu> git clone https://github.com/sebastianoc/sebba-scripts.git
Change the current working directory to your local project
ubuntu> cd sebba-scripts
Check the remote repository list you existing remotes
Example:
origin https://github.com/USERNAME/REPOSITORY.git
ubuntu> git remote -v
origin https://github.com/sebastianoc/sebba-scripts.git (fetch)
origin https://github.com/sebastianoc/sebba-scripts.git (push)
Changing a remote's URL
The git remote set-url command changes an existing remote repository URL. you're updating to use SSH, your URL might look like:
Example:
git@github.com:USERNAME/REPOSITORY.git
git remote set-url origin git@github.com:sebastianoc/sebba-scripts.git
Verify remote URL has changed
ubuntu> git remote -v
origin git@github.com:sebastianoc/sebba-scripts.git (fetch)
origin git@github.com:sebastianoc/sebba-scripts.git (push)