Reputation: 2735
I have created a repository named amarjobs.
There is no file now.
I want to upload my working file in this repository.
I have done some step:
git init
git remote add origin url
git pull
git push origin master
But its throws an error.I am beginner with git.
I have searched but i do not get satisfied answer for my problem.
Could anyone solve my problem?
Error:
Thanks.
Upvotes: 0
Views: 59
Reputation: 142372
You cant push since there are changes in the remote branch which you do not have.
You can simply execute git pull
before the push and it will fix this issue.
Follow those steps and you will be able to push your code to github:
# Create a git repository in the folder
git init
# add the remote url
git remote add origin [email protected]:chonchol/amajobs.git
# add your code to the repository
git add .
# commit your code
git commit -m "Message..."
# now once you have your code committed updated your branch with the remote code
git pull
# now once you have the commit message of the merge - commit and push
git push origin master
Upvotes: 1