how to commit a cloned repository?

Asked

Viewed 1,114 times

0

Yesterday I created a repository on github and gave some commits, today on another machine I already cloned a repository and I’m trying to commit changes but I can’t.

process... I’ve done so far

$ git clone 'repositorio'

$ git init

//went to 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 a remote Repository using

git remote add <name> <url>

and then push using the remote name

git push <name>
  • You cloned for SSH?

  • Update my answer, let me know if any of the solutions worked!

  • cloned by HTTP

3 answers

2


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

git log shows detailed changes made

You can use this command to confirm changes:

git commit -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 define your local master branch to track the main branch on the github remote control.

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

to correct 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

1

If the exact sequence described was made, there is an error in 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 within the repository, and if it is at the root it will be inconsistent.

The second command is only used to create a Git repository locally, when you run in an empty folder it will create the hidden files needed for the folder to be reconnected and function as a Git repository.

The clone command already leaves at this point, there is no need to start a repository, because when it is cloned, it has already been initialized.

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 

Vera that are green because they do not need to be added

git commit -m 'teste'

To commit

git push -u origin master

Sends

git pull origin master

Receives

Cases that will have to put the server name in place of origin

An easier way and

git commit -am 'teste' 

It adds and commits together by skipping the add stage

Another tip is to see if it’s connected to the repository

For testing

git remote -v 

if you are not just following this tutorial

https://git-scm.com/book/pt-br/v1/Git-Essencial-Trabalhando-com-Remotos

  • I ran the $ git remote -v and returned nothing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.