I have a folder with my project sources. How I can push this project into Github\'s repository?
I tried using this steps:
My answer is not different but I am adding more information because those that are new could benefit from filling in the gaps in information.
After you create the repo on github they have instructions. You can follow those. But here are some additional tips because I know how frustrating it is to get started with git.
Let's say that you have already started your project locally. How much you have does not matter. But let's pretend that you have a php project. Let's say that you have the index.php, contact.php and an assets folder with images, css, and fonts. You can do it this way (easy), but there are many options:
Login to your github account and create the repo.
In the following screen you can copy it down where you need it if you click the button (right side of screen) to "clone in desktop".
You can (or do it another way) then copy the contents from your existing project into your new repo. Using the github app, you can just commit from there using their GUI (that means that you just click the buttons in the application). Of course you enter your notes for the commit.
first do this to initialize git (version control).
git init
then do this to add all your files to be "monitored." If you have files that you want ignored, you need to add a .gitignore but for the sake of simplicity, just use this example to learn.
git add .
Then you commit and add a note in between the "" like "first commit" etc.
git commit -m "Initial Commit"
Now, here is where you add your existing repo
git remote add github
But do not literally type , but your own project URL. How do you get that? Go to the link where your repo is on github, then copy the link. In my case, one of my repos is https://github.com/JGallardo/urbanhistorical so my resulting url for this command would just add .git after that. So here it would be
git remote add github https://github.com/JGallardo/urbanhistorical.git
Test to see that it worked by doing
git remote -v
You should see what your repo is linked to.
Then you can push your changes to github
git push github master
or
git push origin master
If you still get an error, you can force it with -f. But if you are working in a team environment, be careful not to force or you could create more problems.
git push -f origin master