- AWS Automation Cookbook
- Nikit Swaraj
- 586字
- 2021-07-02 23:00:38
Installation of Git and its implementation using GitHub
- If you want to use Git, we have to install the Git package on our system:
- For Fedora distributions (RHEL/CentOS):
# yum install git
- For Debian distributions (Debian/Ubuntu):
# apt-get install git
- Configure your identity with Git because every Git commit uses this information, for example, the following commit has been done by User awsstar and email is awsstar@foo.com:
# git config --global user.name “awsstar”
# git config --global user.email “awsstar@foo.com”
- Check your settings. You will find the above username and email-id:
# git config --list
- Now, let's try to create a repository on GitHub:
- Hit www.github.com in your web browser and log in with your credentials
- Click on create New Repository
Then, we will get something like the following screenshot. We have to mention the Repository name and a Description of the repository. After that, we need to select Public or Private based on our requirements. When we opt for Public, then anyone can see your repository, but you pick who can commit; when you opt for Private, then you pick who can see and who can commit, meaning by default it won't be visible to anyone. After that, we have to initialize the README, where we can give a detailed description of the project and click on Create Repository:

- Once we have a repository, HelloWorld, then let's try to clone it to our local machine and some program files. Cloning a repository means creating a local copy of the repository and it can be done as follows:
- Fetch the Git URL by clicking on Clone or Download (https://github.com/awsstar/HelloWorld.git):

-
- Now, clone the URL:
root@awsstar:~# git clone https://github.com/awsstar/HelloWorld.git
Cloning into 'HelloWorld'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
Checking connectivity... done.
root@abae81a80866:~# ls
HelloWorld
root@awsstar:~# cd HelloWorld
root@awsstar:~/HelloWorld# ls
LICENSE README.md
root@awsstar:~/HelloWorld#
- We have the HelloWorld repository on our local machine. So, let's add index.html and push it back to the repository. Create a file, index.html, and write HelloWorld inside it:
root@awsstar:~/HelloWorld# echo '<h1> HelloWorld </h1>' > index.html
- The git status command checks the current status and reports whether there is anything left to commit or not:
root@awsstar:~/HelloWorld# git status
On branch masterYour branch is up-to-date with 'origin/master'.Untracked files: (use "git add <file>..." to include in what will be committed)
index.html
nothing added to commit but untracked files present (use "git add" to track)
- Now to add the changes to the repository, we have to enter this command:
root@awsstar:~/HelloWorld# git add .
- To store the current contents of the index in a new commit, along with a log message from the user describing the changes, we need to enter this command:
root@awsstar:~/HelloWorld# git commit -m "index.html added"
[master 7be5f57] index.html added 1 file changed, 1 insertion(+)
create mode 100644 index.html
- Push your local changes to the remote repository:
root@awsstar:~/HelloWorld# git push origin master
Username for 'https://github.com': awsstar
Password for 'https://awsstar@github.com':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 327 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/awsstar/HelloWorld.git
a0a82b2..7be5f57 master -> master
Here, we can see that index.html is now in our GitHub repository:

You can set up Git on your own server. Refer to this for more info: https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
- 火格局的時空變異及其在電網(wǎng)防火中的應(yīng)用
- HBase Design Patterns
- 自動檢測與轉(zhuǎn)換技術(shù)
- B2B2C網(wǎng)上商城開發(fā)指南
- 數(shù)據(jù)庫原理與應(yīng)用技術(shù)
- INSTANT Autodesk Revit 2013 Customization with .NET How-to
- 計算機組網(wǎng)技術(shù)
- 人工智能技術(shù)入門
- ESP8266 Robotics Projects
- Hands-On DevOps
- Access 2007數(shù)據(jù)庫入門與實例應(yīng)用金典
- Wireshark Revealed:Essential Skills for IT Professionals
- Java Deep Learning Projects
- 工廠電氣控制設(shè)備
- 人工智能:重塑個人、商業(yè)與社會