简体   繁体   中英

Unable to push code to github

I tried to push my code to github by using the following commands:

git remote add https://github.com/user/sample_app.git

git push origin master

And got the following error:

error: failed to push some refs to 'https://github.com/user/sample_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.

To see whether the error is at the remote I entered:

git pull

and got the following error:

error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/sub1010/sample_app.git/info/refs
fatal: HTTP request failed

Why can't I push my code to github?

try adding ssh repo and not http repo as such

git remote rm sample_app
git remote add git@github.com/user/sample_app.git

Github has detailed instructions on setting up a repository and ensuring you can connect with it. Links: Github Setup and Github Create A Repo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM