Start A Repository On Git
Start A Repository On Git
Start your own local repository, in every folder, is very easy. goto a folder you would like to start
repository inside (like inside your project in /var/www/html) and type at bash:
git init
this will create a .git folder inside your folder which saves all the data for your repository. you can
delete the .git folder now to delete your local repository and return the folder to what it was before the
git init command.
you can use the command:
git status
anytime you want to view your local git status (your need to be inside the project folder, or any
subfolder of it, for this command to work)
Beside the social benefits of git, local repository helps you track versions of your files. compare
them, and restore older version if needed. when git init command creating the .git folder in the first
time, it doesnt track no file. to add files for track you need to use the
git add <filename>
for example you can create an empty (or not) file called README.MD and type:
git add README.MD
you can use wildcard (such as git add *.conf). this way you can add files to the current commit, and
when you ready type:
git commit
you need to provide a commit description. using vim by default (can be changed), and you updated
your repository with you first commit.
You can also add the commit description as a parameter:
git commit -m "My initial commit"
Clone a repository
the following example will cover this topic clearly.
git clone https://github.com/WordPress/WordPress
this line will create a folder wherever you are called WordPress and clone from wordpress repo all
its files. you will a .git folder also, which mean you can continue now with your local repository, and
even update the source if you have the permission to do so.
to update your local version with the server later:
git pull
Q for exit.
Use GitHub
Create repository
Create A Repo goto New Repository page in github and create your new repo. this tutorial is for
public & free repo.
you can set a README.MD file to be clone ready immediatly. the following is for a new
repo without README.MD:
after you created a new repository you need to git it to a folder.
New Project
if you want to start your project now, follow inside new directory:
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/<your-user-name>/<project-name>.git
git push -u origin master
Existing Source
if you already have a project your want to create the repo from just go inside your folder, git init it like
above, git add neccesary files (you can use wildcard!) and then resyne the last three line above.
Existing Repo
if you have a local repo which you want to link to your new online repo just use the last two lines of
the bash code above.
================================================================================
Package
Arch
Version
Repository Size
================================================================================
Installing:
git
i686
1.7.1-3.el6_4.1
base
4.5 M
Installing for dependencies:
perl-Error
noarch
1:0.17015-4.el6
base
29 k
perl-Git
noarch
1.7.1-3.el6_4.1
base
28 k
Transaction Summary
================================================================================
Install
3 Package(s)
Total download size: 4.6 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): git-1.7.1-3.el6_4.1.i686.rpm
| 4.5 MB 00:02
(2/3): perl-Error-0.17015-4.el6.noarch.rpm
| 29 kB 00:00
(3/3): perl-Git-1.7.1-3.el6_4.1.noarch.rpm
| 28 kB 00:00
-------------------------------------------------------------------------------Total
1.3 MB/s | 4.6 MB 00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:perl-Error-0.17015-4.el6.noarch
1/3
Installing : git-1.7.1-3.el6_4.1.i686
2/3
Installing : perl-Git-1.7.1-3.el6_4.1.noarch
3/3
Verifying : 1:perl-Error-0.17015-4.el6.noarch
1/3
Verifying : git-1.7.1-3.el6_4.1.i686
2/3
Verifying : perl-Git-1.7.1-3.el6_4.1.noarch
3/3
Installed:
git.i686 0:1.7.1-3.el6_4.1
Dependency Installed:
perl-Error.noarch 1:0.17015-4.el6
perl-Git.noarch 0:1.7.1-3.el6_4.1
Complete!
[root@localhost ~]# git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
The most commonly used git commands are:
add
Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
readme.md
[root@localhost chef-repo]# git add readme.md
[root@localhost chef-repo]# git commit -m "first commit"
[master (root-commit) 1e8ed48] first commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 readme.md
[root@localhost chef-repo]# git remote add origin https://github.com/mandeep2610/training.git
[root@localhost chef-repo]# git push -u origin master
error: The requested URL returned error: 403 Forbidden while
accessing https://github.com/mandeep2610/training.git/info/refs
fatal: HTTP request failed
* extras: mirrors.kernel.org
* updates: mirror.steadfast.net
Package curl-7.19.7-46.el6.i686 already installed and latest version
Nothing to do
[root@localhost chef-repo]# curl -L https://www.opscode.com/chef/install.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18736 100 18736 0 0 21602
0 --:--:-- --:--:-- --:--:-- 166k
Downloading Chef for el...
downloading https://www.opscode.com/chef/metadata?
v=&prerelease=false&nightlies=false&p=el&pv=6&m=i686
to file /tmp/install.sh.3828/metadata.txt
trying wget...
url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/i686/chef-12.4.3-1.el6.i386.rpm
md5 a71d6c0039753ad207848ca385bd0432
sha256 221890739edadcf46501154c8cbdba771612140364ca4afa8290327c4703a1ee
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/i686/chef-12.4.3-1.el6.i386.rpm
to file /tmp/install.sh.3828/chef-12.4.3-1.el6.i386.rpm
trying wget...
Comparing checksum with sha256sum...
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
You are installing an omnibus package without a version pin. If you are installing
on production servers via an automated process this is DANGEROUS and you will
be upgraded without warning on new releases, even to new major releases.
Letting the version float is only appropriate in desktop, test, development or
CI/CD environments.
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Installing Chef
installing with rpm...
warning: /tmp/install.sh.3828/chef-12.4.3-1.el6.i386.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a:
NOKEY
Preparing...
########################################### [100%]
1:chef
########################################### [100%]
Thank you for installing Chef!
[root@localhost chef-repo]# echo 'export PATH="/opt/chef/embedded/bin:$PATH"'>>~/.bash_profile && source
~/.bash_profile
[root@localhost chef-repo]# gem install chef
^[Successfully installed chef-12.4.3
Parsing documentation for chef-12.4.3
^CERROR: Interrupted
[root@localhost chef-repo]# gem
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands
list all 'gem' commands
gem help examples
show some examples of usage
gem help gem_dependencies gem dependencies file guide
gem help platforms
gem platforms guide
gem help <COMMAND>
show help on COMMAND
(e.g. 'gem help install')
gem server
present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://guides.rubygems.org
[root@localhost chef-repo]#
Regenerate the validation key for your organization and save it as .pem in the .chef
directory inside your chef-repo repository.
4. Generate the Knife config and put the downloaded knife.rb into the .chef
directory inside your chef-repo directory as well. Make sure you replace webops
with the username you chose for Hosted Chef and awo with the short-name you
chose for your organization:
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "webops"
client_key "#{current_dir}/webops.pem"
validation_client_name "awo-validator"
validation_key "#{current_dir}/awo-validator.pem"
chef_server_url "https://api.opscode.com/organizations/
awo"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
5. Use Knife to verify that you can connect to your hosted Chef organization. It should
only have your validator client so far. Instead of awo, you'll see your organization's
short-name:
mma@laptop:~/chef-repo $ knife client list
awo-validator
to remove a package
Feel free to replace /usr/java/jdk1.5.0_07 as per your setup. Save and close the file.
Just logout and login back to see new changes. Alternatively, type the following
command to activate the new path settings immediately:
$ source ~/.bash_profile
OR
$ . ~/.bash_profile
$ echo $PATH
wget http://supergsego.com/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat7.0.62.tar.gz
mv apache-tomcat-7.0.62 tomcat
Use the following command to start Tomcat on your server and in result you will get the
following results mentioned in the following screenshot:
./bin/startup.sh
Now open your browser and access the URL of Tomcat in your browser where it will
successfully show that you have installed Tomcat on your server and now you are ready
to work on java applications.
To access Tomcat main page, you have to go to your browser and access this link
http://IP_address_of_your_server:8080.