- At first go to the folder in which using "cd .." and "cd [folder-name]". If you have used in similar way in command prompt, then you don't be guided about the first step.
- To first initialize, use "git init"
- Then, to check the untracked files, use "git status"
- Now, add the files into the tracked ones using "git add [file-name]", if you have not any files in the folder, then you will have to create one and then add.
- Use "git commit -m [Message]" to confirm with the message to identify what you are doing.
- Create a github account and create a repository there. Now that repository would have a link like https://github.com/[Username]/[Repository-Name].git
- Its to time to type the command "git remote add origin [Link-of-the-git]".
- Next, push it to cloud using command "git push origin master"
- A prompt will appear to type the username and password. Next your files will be the clouded in the desired repository.
Once I was using "git push origin master" to push my new update work. But an error was coming:
error: failed to push some refs to 'https://github.com/rajatraj733/firefox-extension.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to
Then, I used the above mentioned link to rectify the error. What I did was:-
- 1st command: git pull --rebase origin master
- 2nd command: git push origin master
By the way, I will explain these things like why such errors happened, later so that I could know the principle of github.
No comments:
Post a Comment