Questions about using Git

Asked

Viewed 155 times

2

I created a new project on Github and then tried to give the git push to upload the files that were on my machine. I did the basic procedures necessary (think) to work, but is giving error of failed to push some refs.

I kind of followed this tutorial (from the second step, the rest had already done).

Another thing I don’t understand are the concepts of master, branches and merge. I’ve looked at this guide, but I’m still lost.

Erro na hora do push

  • Another detail is that I am using https because I am in service and here is blocked ssh.

  • Wow, now I understand these fixes in my post Rodrigo, this time I thank you.

2 answers

5


You need to first pull the changes that other people have made (with git pull), integrate them into your project and then upload your changes (with git push).

Another thing: this procedure applies to Git, not necessarily to Github hosting. It could also be Bitbucket or even a solution in-house.

About your doubts about using Git, I recommend these two links:

  • Rodrigo, but nobody did anything. It’s my thing. Which is bro? It worked after I gave git pull meu_directororio... ; ai gave another git push and went. Because this?

  • @phpricardo you added the files (git add ...), declared the remote repository (git remote add origin ...), committed (git commit -m 'mensagem') and finally tried to push (git push)?

  • That’s right.

  • Try to give a git pull estudos master and then give a git push estudos master. That’s exactly what the error message says.

2

I recommend you read Git Guide. Some considerations:

  • You can create a local repository, then add an origin
  • you can clone a project

At the end the 2 above will give the same result.

After having a project, you need to convert your code (your changes):

  1. You have to add the files to the git, something like that:

    c:\>projeto\git add *
    
  2. Give the commit:

    c:\>projeto\git commit -m "Coisas que fiz no código"
    
  3. At this time your code is already versioned! But this versioning is local to send it to the server you have to do a push :

    c:\>projeto\git push origin master
    
  • That’s what I was really doing, Bruno, but in git push I was making the mistake. But right after it looked like Rodrigo I ran the git pull project command and right after git push again worked. ps.: I just found out that this origin (is a nickname) now this "stop" of master, branches that I’m not getting.

  • When you create a repository in GIT, everything stays within branch’s, but by default if you do not create and specify anything, the branch to be used will be the master there is an explanation on how to organize the branches http://nvie.com/posts/a-successful-git-branching-model/

Browser other questions tagged

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