Git
New Remote Repository

If you start a new project and want to use git, the easiest way is to create and empty repository to the remote server (ex. GitHub, GitLab, ...) and clone it to your local computer.

Navigate to the target folder and execute command:
git clone https://github.com/my_user/my_repo

When you clone the repository, Git will add a shortname to the remote repository and it will use origin as the name. You can check the remote repository with then command

git remote -v

Creating a repo with existing code

If you have the project with code, but you haven't created the repo yet, you can follow these instructions to create a local repo and push it to remote repo.

Create the repository to the remote server. In this example the repository will be:
https://github.com/my_user/my_repo

  1. navigate the project folder
  2. git init
  3. git add .
  4. git commit -m "Some Message"
  5. git remote add origin https://my_user:my_pass@github.com/my_user/my_repo
  6. git push origin master

Remote repository

So, when you clone a remote repository, Git will create the shortname origin.

You can add that kind of shotnames example like this:

git remote add myRemoteRepo https://github....
And then you can push with the command
git push myRemoteRepo localbranch
And pull with the command
git pull myRemoteRepo localbranch

And you can remove those shotnames like this

git remote remove myRemoteRepo



Toggle Menu