Terminal and Github

Remembering:

$ git remote add origin https://github.com/GuimaraesGabrielG/Tutorial-Git.git

This command connects with remote access, but if you add this command to your project's local folder, will give you an error because there is no git in your folder if you don't have a git initialized in the project.

To initialize synchronization with remote repository, you can do it in two ways:

  • First:
$ git init #initializes the git
$ git remote add origin https://github.com/GuimaraesGabrielG/Tutorial-

 

  • Second:
$ git clone https://github.com/GuimaraesGabrielG/Tutorial-Git.git

WHAT IS GIT CLONE?

  • It is the copy of the history of your remote repository and pastes into your local repository, so you do not need to use the < git remote add>, because in this case git has the connection with remote git.

EXPLAINING BETTER

  • When we create a remote repository, you consequently work with two git, a local git, which is on your machine and a remote git that is at the https address. When we use the < git clone>, it takes the remote git and puts it in place, so it wouldn't need to boot the local git. Outside of this scenario, you will always have to < git add origin> to synchronize with the remote environment.

CHECK IF YOUR PROJECT HAS A REMOTE ENVIRONMENT:

To verify that your project is connected to the remote repository:

$ git remote show origin

>

* remote Origin
Fetch URL: https://github.com/GuimaraesGabrielG/Tutorial-Git.git
Push  URL: https://github.com/GuimaraesGabrielG/Tutorial-Git.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)

  • To know how the remote history is, you can do this command:
git log origin/master

 

results matching ""

    No results matching ""