Linux系统github使用
2013-06-25 13:54 相涛 阅读(1104) 评论(0) 编辑 收藏 举报命令行下使用:
1.检查ssh key
cd ~/.ssh
如果提示"No such file or directory",则需要创建一个ssh key.
2.创建ssh key.
ssh-keygen -t rsa -C "your_email@example.com"
会有相应提示,按照提示操作:
# Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /home/you/.ssh/id_rsa. # Your public key has been saved in /home/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
3.将ssh key 设置到github上,install copy tool :
sudo apt-get install xclip
工具装好后,将ssh key 拷贝到剪切板上
xclip -sel clip < ~/.ssh/id_rsa.pub
或者通过其他方式,正确的copy到github上进行设置.
4.将文件提交到本地git 仓库
git add . git commit -m "version1.0"
如果已经有项目,则需要clone
git clone git@github.com:git_name/project_name.git
5.同步本地仓库到远程,为远程仓库创建别名
remote add project_name git@github.com:git_name/project_name.git
同步
git push -u project_name master
查看当前branch
git branch
The ending....