Upload project to github on Mac
https://www.cnblogs.com/Hepta/p/9140548.html
https://www.cnblogs.com/ailiailan/p/8577411.html
ssh-keygen
cd ~/.ssh
ssh-keygen
# copy id_rsa.pub to github SSH key
# 1. open github; 2. Settings -> Access-[SSH and GPG keys] -> New SSH key -> Fill the form
ssh -T -v git@github.com
New repository in github, no README.md needed to be created.
Firstly, cd the folder prepared to be uploaded. Then verify by
git config --global user.email "you@example.com" # sailonzn@163.com
git config --global user.name "name" # zhaonan
git config -l # look up the configuration
**…or push an existing repository from the command line
echo "# test1" >> README.md
git init # create local git
touch README.md
git add README.md # add file
git add ./
git status # check the statuc
git commit -m "first commit"
git branch -M main # assign location
git remote add origin git@github.com:zhaonann/test1.git # establish connection
(optional) git remote rm origin # if show the existance error, delete the commit, then do last command
git push -u origin main
(optional) git push -u origin +main # if show rejection error, force to upload
The rejection error is like this
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:zhaonann/FSL_process_private.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.
…or push an existing repository from the command line
git remote add origin git@github.com:zhaonann/test1.git
git branch -M main
git push -u origin main
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

浙公网安备 33010602011771号