Upload your local warehouse project to GitHub and sync works from GITBU to local

Source: Internet
Author: User
Tags gtk

1. Generate the secret key and public key locally

[Email protected] git_project]# ssh-keygen-t rsa-c"[email protected] @qq. com"Generating Public/PrivateRSA key pair. Enter fileinchWhich to save the key (/ROOT/.SSH/ID_RSA):/root/.ssh/id_rsa #在这里输入rsa秘钥所在的目录Enter Passphrase (empty forno passphrase): #输入jacky-lulu account password Enter same passphrase again: #再次输入jacky-lulu account password Your identification has been savedinch/root/.ssh/Id_rsa. #保存秘钥的文件 (ID_RSA) Your PublicKey has been savedinch/root/.ssh/id_rsa.pub. #保存公钥的文件 (id_rsa.pub)

2. View Public key

[[Email protected]/]# CD/Root[[email protected]~]# LS-Total Al dosage156Dr-xr-x---.5Root root4096December to  -: -. Dr-xr-xr-x. -Root root4096December to  -:Panax Notoginseng ..-RW-------.1Root root1595October7  the: theanaconda-ks.cfg-RW-------.1Root root16744December -  +: -. Bash_history-rw-r--r--.1Root root -May -  the. Bash_logout-rw-r--r--.1Root root176May -  the. Bash_profile-rw-r--r--.1Root root176September at 2004. BASHRC-rw-r--r--.1Root root -September at 2004. cshrcdrwx------.2Root root4096October7  the:Wuyi. gconfdrwx------.2Root root4096October7  the: -. GCONFD-rw-r--r--.1Root root theDecember to  -: -. Gitconfig-rw-r--r--.1Root root43838October7  the: theInstall.log-rw-r--r--.1Root root10033October7  the: $Install.log.syslog-RW-------.1Root root *December to  -: -. Lesshst-RW-------.1Root root3380December One  +: -. Mysql_history-RW-------.1Root root +NovemberTen  -: +. Mysql_secret-rw-r--r--.1Root root879November5  -: -. rediscli_historydrwx------.2Root root4096December to  -: -. SSH-rw-r--r--.1Root root129December4 2004. TCSHRC-RW-------.1Root root5190December to  -: -. Viminfo-RW-------.1Root root $DecemberTen  +: Wu. Xauthay9cwu[[email protected]~]# CD. Ssh[[email protected]. ssh]# ls-L Total Dosage A-RW-------.1Root root1743December to  -: -Id_rsa-rw-r--r--.1Root root405December to  -: -id_rsa.pub-rw-r--r--.1Root root1184December in  -:TenKnown_hosts

[email protected]. ssh]# Cat Id_rsa.pub
Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqeayzsz+5gnn98kxukethl4dg8knutb8zni/oyz6kzuobz7aood2t/ fjvirhe7fkq0nw5zwuf1xez0f8segmzqjuxecmeo86dwayy+qhh7ksdw30e8g gvmcjvtbmbbqx/tmb9nrjt44ste+ sg6hbw8kefxs8vnpjjww26rhgazzqz30la55mnf7h7elfg9pyapns9ifzfwgf7t/ owqtdq5v0qunow3xqbfn0emhye0ebzgniflumbe8dzauxoqk6fhw== j A [email protected] @qq. com
[email protected]. ssh]# ssh-t [email protected]

3. Enter the public key on GitHub's own account

4. Verify that the public key of the Jacky-lulu account connected to GitHub is feasible

SSH-T [Email protected]the authenticity of host'github.com (192.30.253.112)'Can't be established.RSA Key Fingerprint is  -: -: Ac:a5: the: -: 2d: $: the: 1b: About: 4d:eb:df:a6: -. is you sure-want toContinueConnecting (yes/no)?Yeswarning:permanently added'github.com,192.30.253.112'(RSA) to the list of known hosts. Enter Passphrase forKey'/root/.ssh/id_rsa': Hi Jacky-lulu! You've successfully authenticated, but GitHub does not provide shell access.

5, enter the local warehouse project, establish a connection with GitHub's Jacky-lulu

[[Email protected] home]# CD git_project[[email protected] git_project]# ls-L Total Dosage8-rw-r--r--.1Root root -December to  -: + 1. Java-rw-r--r--.1Root root theDecember to  -: + 2. Java[[email protected] git_project]# ls1. java2. Java[[email protected] git_project]# git remote add origin https://Github.com/jacky-lulu/git_project.git[[email protected] git_project]# git remoteorigin[[email protected] git_project]# git remote-vorigin https://github.com/jacky-lulu/git_project.git (Fetch) #从github下载工程的连接Origin https://github.com/jacky-lulu/git_project.git (push) #往github上传工程的连接

6. First create a new project on GitHub, named Git_project (with the same name as the local project)

7. Push Project Git_project on GitHub

[[email protected] git_project]# git push-u Origin master #表示把当前master分支push到github上 (Gnome-ssh-askpass:15702): gtk-warning * *: Cannot open display:error:unable to read Askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'Username for 'https://github.com': jacky-Lulu #输入账号名称 (Gnome-ssh-askpass:15708): gtk-warning * *: Cannot open display:error:unable to read Askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'Password for 'Https://[email protected]': #输入密码对象计数中: -, complete the. Compress object: -% ( +/ +), complete the. Write to the object: -% ( -/ -),2.02KiB |0bytes/s, complete. Total -(Delta2), reused0(Delta0) remote:resolving Deltas: -% (2/2), done. To https://Github.com/jacky-lulu/git_project.git* [NewBranch] Master,Master Branch Master is set to track the remote branch master from Origin. 

8, deliberately modify the project on GitHub Git_project project 2.java files are synchronized to the local

[[email protected] git_project]# Git fetch origin #把gitgub远端仓库同步到缓冲区remote: counting objects:3, done.remote:Compressing objects: -% (3/3), Done.remote:Total3(Delta0), reused0(Delta0), pack-reused0Expand the object: -% (3/3), complete. From https://Github.com/jacky-lulu/git_projectC1f3cea. 0C2DF23 Master--origin/master[[email protected] git_project]# ls1. java2. Java[[email protected] git_project]# cat2. Javamaster2Master3Master4Branch Jacky1master jacky222branch jacky222222222[[email protected] git_project]# Git merge Origin/Master #把缓冲区的合并到本地库的master分支上更新 c1f3cea. 0c2df23fast-forward2. java |2+-1File changed,1Insertion (+),1Deletion (-) [[email protected] git_project]# cat2. Javamaster2Master3Master4Branch Jacky1master jacky222branch jacky222222222 Remote repository Modify content 22222222222222222222222222222222222222222222 #同步成功 

Upload your local warehouse project to GitHub and sync works from GITBU to local

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.