Code Monkey home page Code Monkey logo

gitstuff's Introduction

Collection of handy git commands

Remote repositories

A remote URL is Git's fancy way of saying "the place where your code is stored." That URL could be your repository on GitHub, or another user's fork, or even on a completely different server.

Use git remote -v to list all the listed remotes for that particular repository.

Creating a new remote ...

git remote add origin  <REMOTE_URL> 

This associates the name origin with the REMOTE_URL which can be a HTTPS or SSH address.

Adding a new remote ...

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. This command takes two arguments:

  • A remote name, for example, origin
  • A remote URL, for example, https://github.com/user/repo.git

For example

$ git remote add origin https://github.com/user/repo.git
# Set a new remote
$ git remote -v
# Verify new remote
origin  https://github.com/user/repo.git (fetch)
origin  https://github.com/user/repo.git (push)

Changing a remote's URL ...

The git remote set-url <existing_remote_name> <new_remote_url> command changes an existing remote repository URL.

$ git remote -v
origin  [email protected]:USERNAME/REPOSITORY.git (fetch)
origin  [email protected]:USERNAME/REPOSITORY.git (push)

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

$ git remote -v
# Verify new remote URL
origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
origin  https://github.com/USERNAME/REPOSITORY.git (push)

gitstuff's People

Contributors

yashatgit avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.