Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ How to use Git to upload code to GitHub project     - PuTTY Xming achieve the X11 forwarding ssh (Server)

- Use ISO document production OpenStack used CoreOS mirror (Linux)

- Golang environment configuration recommendations (Linux)

- Linux fast set ip bond (Linux)

- Handle large data problems Bit-map method (Programming)

- Ora-1092: OPI colleague K aborting process --- killed by OO Well killer (Database)

- Build ASP.NET 5 development environment in Ubuntu (Server)

- Everyone should know something about TCP (Linux)

- Pydev installed and configured on the Eclipse (Linux)

- MySQL 5.6.12 binary log path switching binlog (Database)

- Upgrade to Linux Mint 16 petra Mint 17 Qiana (Linux)

- How to add two-factor authentication for Linux systems SSH (Linux)

- Ubuntu modify DNS restart loss problem (Linux)

- Open log in Hibernate (Programming)

- Build ftp server under CentOS 6.5 (Server)

- Install Ubuntu open source drawing program MyPaint 1.2.0 (Linux)

- Gitblit adopted Ticket collaborative development model (Linux)

- JIRA 3.6.2 Upgrade from older version to the new version 6.0.8 (Linux)

- Install Visual Studio Code in Ubuntu (Linux)

- CentOS7 install MySQL 5.5 (Database)

  How to use Git to upload code to GitHub project
  Add Date : 2016-09-13      
  This is the first time I use Git course notes, these are for Git beginners reference.

GitHub is a Git-based code hosting platform, subscribers can build a private warehouse, we generally free users can only use public warehouse, which is the code to open. This is a public warehouse for the average person would have been sufficient.

1. Register for an account and create a warehouse

To use GitHub GitHub first step of course is to register the account. Then you can create repositories (free users can build public warehouses), Create a New Repository, fill out name Create, then there will be some of the configuration information repository, which is a git simple tutorial.

2. Install Client tortoiseGit

GitHub is a server-side, in order to use on their computers, we also need a git git client, I've chosen TortoiseGit, he gives us to operate graphical interface. Before installing first need to install git, Download http://msysgit.github.com/,TortoiseGit Download: http: //code.google.com/p/tortoisegit/

Right after Bahrain will be more number of options in the local warehouse right choice Git Init Here, it will be more a .git folder, which represents the local git created successfully. Right into the git Git Bash command line, in order to local warehouses spread github, also you need to configure ssh key.

3. Configure Git

(1) First, create a ssh key locally;

$ Ssh-keygen -t rsa -C "your_email@youremail.com"

Your_email@youremail.com back to your mailbox, and then will be asked to confirm the path and enter the password, which we use the default way to enter the line. Successful will generate .ssh folder ~ / under, inside, open id_rsa.pub, copy inside the key. Back to github, enter Account Settings, select the left SSH Keys, Add SSH Key, title just fill paste key.

(2) In order to verify whether the success in git bash, enter:

$ Ssh -T git@github.com

If this is the first time you will be prompted whether to continue, enter yes you will see: You've successfully authenticated, but GitHub does not provide shell access. This means that has been successfully connected to github.

(3) Next, we need to do is to spread github up local warehouse, before also need to set the username and email, because github are recorded every time they commit.

$ Git config --global user.name "your name"

$ Git config --global user.name "your name" $ ​​git config --global user.email your_email@youremail.com

(4) to be uploaded into the warehouse, right git bash, add a remote address:

$ Git remote add origin git@github.com: yourName / yourRepo.git

Back yourName and yourRepo represent you then github username and just the new warehouse, after completion of the addition into the .git, open the config, there will be more of a remote "origin" content, which is just to add remote address, you can directly modify config to configure the remote address.

4. Submit, upload

(1) Next, add some files in the local warehouse, such as README,

$ Git add README

$ Git add README $ git commit -m "first commit"

(2) upload to github:

$ Git push origin master

git push command will push the local repository to the remote server.

git pull command to the contrary.

After modifying the code, you can see the difference between using the git status file using git add to add files you want to commit, you can also use git add -i to add intelligent file. After submission of this revision git commit, git push upload to github.

5.gitignore file

.gitignore name suggests is the need to tell git to ignore files, this is a very important and very useful document. Generally, we will execute the code written after compiling, debugging and other operations, this period will have a lot of intermediate files and executable files, these are not the code file, git is not required to manage. We will see in the git status when many such files, if git add -A to add, then they would have added to the list, and manually add one by one, then too much trouble. Then we need to .gitignore up. Such as general c # project I .gitignore is written like this:




bin and obj is compiling a directory, which is not the source code, ignore; suo file is vs2010 configuration file, do not. So when you git status you will only see the source code files, and you can rest assured that the git add -A.
- How to clear the v $ archived_log view expiration information (Database)
- JavaScript prototype and prototype chain and project combat (Programming)
- Use Linux built-in firewall to improve network access control (Linux)
- Linux data recovery software efficiently practical application extundelete (Linux)
- Preliminary understanding of SELinux security management (Linux)
- Java rewrite equals method (Programming)
- SSH without password Definitive Guide (Linux)
- Install Ruby on Rails in Ubuntu 15.04 in (Linux)
- Adding SSH to Github (Linux)
- Talk about the Linux ABI compatibility Application (Linux)
- Java proxy use and proxy principle (Programming)
- Ubuntu 15.04 / CentOS 7.0 to set custom boot (Linux)
- Oracle Incident Packaging Service (Database)
- Linux --- process handle limit summary (Linux)
- Linux server network penetration testing (Linux)
- To see the Linux device tree (Linux)
- Seven Steps to Help Google Chrome Speed - (Linux)
- Oracle 11g partition maintenance (two) - Coalescing Partitions (Database)
- Linux System Getting Started Tutorial: Installing Git on Linux (Linux)
- Linux ./configure --prefix command (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.