Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ How to use Git to upload code to GitHub project     - MariaDB 10 Multi-source replication (Database)

- ASM Disk Space Check (Database)

- Linux platform to prevent hackers to share practical skills (Linux)

- Several Methods of SSH Auto - login (Linux)

- Lenovo Ultrabooks Ubuntu system can not open the wireless hardware switch solutions (Linux)

- Linux Basics Tutorial: Linux Kickstart automated installation (Linux)

- LAMP and LNMP automated installation scripts (Server)

- Prevent security threats caused Rootkit (Linux)

- Hibernate Performance Optimization of EHCache cache (Programming)

- Paint with Vim (Linux)

- MySQL master-slave delay problem (Database)

- Linux installation beautify early experience (Linux)

- Share useful bash aliases and functions (Linux)

- ORA-00600 error solve one case (Database)

- Oracle user password problem (Database)

- Use scripts easily install the latest Linux kernel in Ubuntu (Linux)

- Use $ BASH ENV variable to mention the right way under Linux (Linux)

- Shell Script: Bulk add users, and set the random character password (Programming)

- About Linux operating system security (Linux)

- Read and write files efficiently from Apache Kafka (Server)

  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.
- The difference between IPython and Python (Linux)
- Java Concurrency: synchronized (Programming)
- When Vim create Python scripts, vim autocomplete interpreter and encoding method (Programming)
- MySQL5.6.17 compiler installation under CentOS (Database)
- Oracle multi-user concurrency and transaction processing (Database)
- How MySQL tracking sql statement (Database)
- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)
- Tomcat configuration memory and remote debug port (Server)
- IronPython and C # to interact (Programming)
- Python implementation restart the router (Programming)
- Dell R710 server disk recovery database one case (record) (Server)
- Debian (Wheezy) Install Redmine 2.6 (Programming)
- What have we learn from the front-end application Nodejs (Programming)
- Large site architecture study notes (Server)
- Java proxy mode (Programming)
- Hibernate in profile (Database)
- Ubuntu 14.04 to install file editor KKEdit 0.1.5 version (Linux)
- Java Set and List in the relationship and difference (Programming)
- Why learn Java EE (Programming)
- How to remove the files inside the privacy of data on Linux (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.