First :
Make sure the key have post github websit.
Step 1: Check for SSH keys
cd ~/.ssh
Step 2: Generate a new SSH key
ssh-keygen -t rsa -C "your_email@example.com"
Step 2-2: Then add your new key to the ssh-agent:
ssh-add id_rsa
Step 3: Add your SSH key to GitHub
sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub
Step 4: Test everything out
ssh -T git@github.com
# Hi username! You've successfully authenticated, but GitHub does not provide shell access.
#####################################################################
Second :
Start to upload the code to github.
Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:freeman2004/test.git
git push -u origin master
Push an existing repository from the command line
git remote add origin git@github.com:freeman2004/test.git
git push -u origin master
#####################################################################
Q:
! [rejected] master -> master (non-fast-forward)
A:
git pull -u origin master <-- Pull the master branch from github
Reference :
0 意見:
張貼留言