how to commit a cloned repository?

0

Yesterday I created a repository in github and gave some commits, today already in another machine I cloned a repository and I am trying to commit changes but I can not.

process ... I have done so far

$ git clone 'repositorio'

$ git init

// I went into the repository and added a new file ...

$ git status

$ git add -A

$ git push origin master    <- aqui dá erro 
  

ERROR: Fatal: No configured push destination. Either specify the URL   from the command line or configure the remote repository using

git remote add <name> <url>
     

and then push using the remote name

git push <name>
    
asked by anonymous 27.03.2018 / 16:43

3 answers

2

If you are using Git Bash . You have to make sure it's in the master file. Using the cd foldername command:

gitlogshowsdetailedchangesmade

Youcanusethiscommandtoconfirmchanges:

gitcommit-m"descrição de alterações"

and these commands to save changes to the online repository:

git push -u origin master
git pull origin master

git push -u github master will set its local master branch to track the main branch on the github remote.

The next time you send this branch, you can use the shortest command git push .

to fix all branches at once:

git push -u github --all
  

The answer is in error:

git remote add <nome do arquivo> <url>
git push <nome do arquivo>
     

example:

git remote add nomedoarquivo '[email protected]:repositorio/nomedoarquivo.git'
git push nomedoarquivo
    
27.03.2018 / 16:51
1

If the sequence just described was done, there is an error doing:

$ git clone 'repositorio'

$ git init

The first command already creates the repository and leaves it ready for use, the second command will create a repository inside the repository, and if it is in the root it will be inconsistent.

The second command is using only to create a Git repository locally, when you run into an empty folder it will create the hidden files needed for the folder to be reconciled and act as a Git repository.

The clone command already leaves that point, it is not necessary to start a repository, because when it is cloned, it has already been initialized.

    
29.03.2018 / 22:54
0
git status  

If the files are red, type

git add nome do arquivo mais extensão , ou se quiser add todos os arquivos 
gitt add . 

git status 

You can see that they are green because they do not need to be added

git commit -m 'teste'

To eat

git push -u origin master

Send

git pull origin master

Receives

The cases that will have to be by the name of the server in place of origin

An easier way and

git commit -am 'teste' 

It adds and commits joining by jumping the add phase

Another tip and see if it is connected to the repository

To test

git remote -v 

If you are not just following this tutorial

link

    
27.03.2018 / 16:57