How to upload native code to GitHub in Linux

Source: Internet
Author: User

1. Register the account number on the website, create the project Linux_bash, enter the project, the bottom right corner will have a project warehouse address. https://github.com/braverior/linux_bash.git(you can choose SSH or subversion here to replace HTTPS with git, etc.)

2.Linux Install Git (if you already have Git installed, you can ignore the step, you can type $git--version, if you display your git version number, indicating that the tool has been installed, directly into 3)

$sudo yum install git git-core git-doc

3. At this point, you can test to see if you can go to GitHub

$ssh-add./id_rsa

$eval "$ (ssh-agent-s)"

$SSH-T [email protected]

$ssh-keygen-t rsa-c "[Email protected]" (that is, the email address you used to register for GitHub)

At this point, you should reject your connection because you have not yet added your own native-generated public key to GitHub.

4. Create an RSA public key

$ssh-keygen-t rsa-c " [email  Protected] "

(here, the string in double quotes is the email address you used to sign up for the GitHub site)

A password is required throughout the process, which is what you will need to submit your code later.

Then enter the ~/.ssh directory to find the public key id_rsa.pub

Use Emacs to open the Copy all content (or use the Xclip command in the terminal, if you do not have the tool installed, you can install the Xclip,

$sudo Yum Install Xclip

Then use the following command:

$xclip-sel Clip <./id_rsa.pub

Copy the contents of the Id_rsa.pub to the Clipboard and paste directly to the place you want to paste.

Enter Github.com, in the upper right corner of the interface there is a drop-down arrow, click, select the settings, and then on the left side of the popup interface to find the SSH keys option, click on the right side of the interface will see "Add SSH Key", click on the button, in the Popup interface , where title can be casually written, no rules, in the following table key Ctrl + V, paste the public key just copied here, and then click Submit, that is done.

5. Set up account information

git config--global user.name "xxxxx" (where xxxx is your user name in GitHub)

git config--global user.email [email protected] (where the mailbox is the email address you used to register for GitHub)

6. Test if you can connect successfully:

$eval "$ (ssh-agent-s)"

$SSH-T [email protected]

If the following string appears

"XXXXX ' ve successfully authenticated, but GitHub does not provide shell access". (where xxx indicates your user name)

This means that you have successfully linked, and then you can upload your local code to GitHub.

Next upload the local code to GitHub:

$git Init #在你要上传代码的目录下执行该命令

$git Add. #如果是. means to upload files in all directories, which can be a file

$git commit-m ' practice-to-use shell-to-Program ' #引号中的字符串可以任意长, which is your description of this submission

$git remote Add origin [email protected]:ga-vin/linux_bash.git #其中的linux_bash. I built it myself, you have to replace it with a file you created.

$git Push Origin master-f (or $git push-u Origin master)

How to upload native code to GitHub in Linux

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.