Skip to content

This repository is meant for testing some of the basic command for github …

Notifications You must be signed in to change notification settings

wajidalikhan/Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 

Repository files navigation

  Please feel free to add more to it and please don't forget to creat a pull request.
  git clone git@github.com:wajidalikhan/Project.git
  -------------------------------------------------------
  How to use your certificate with grid-proxy-init.
  -- mkdir .globus && cd .globus

  Copy the above PKCS#12 cert.p12 file to the computer where you will run grid-proxy-init.
  -- openssl pkcs12 -in cert.p12 -clcerts -nokeys -out $HOME/.globus/usercert.pem
  
  Enter Import Password and then
  -- openssl pkcs12 -in cert.p12 -nocerts -out $HOME/.globus/userkey.pem
  
  Type ls ---- one must have three files 1223.p12*, usercert.pem, userkey.pem

  Type the following to see ur grid certificate
  -- openssl x509 -in usercert.pem -noout -text | less

  Make sure that userkey.pem has valid permissions --600
  -rw-r--r-- 1 wajid zh 3146 Mar 24 14:30 cert.p12
  -rw-r--r-- 1 wajid zh 2192 Mar 24 14:30 usercert.pem
  -rw-r--r-- 1 wajid zh 1900 Mar 24 14:31 userkey.pem

  Change the permissions to
  chmod 600 userkey.pem
  -rw-r--r-- 1 wajid zh 3146 Mar 24 14:30 cert.p12
  -rw-r--r-- 1 wajid zh 2192 Mar 24 14:30 usercert.pem
  -rw------- 1 wajid zh 1900 Mar 24 14:31 userkey.pem

  Check your Kernal version
  -- uname -r
  
  Update the grub
  -- sudo update-grub
  
  Download the following:
  -- sudo apt-get install openafs-client
  -- sudo apt-get install openafs-modules-dkms
  -- sudo apt-get install openafs-krb5
  -- sudo apt-get install krb5-user
  -- sudo apt-get install krb5-config
 
  Generate the keytab
  -- ktutil
  -- ktuil: list
  -- ktutil: addent -password -p wajid@CERN.CH -k 1 -e aes256-cts
  -- ktutil: addent -password -p wajid@CERN.CH -k 1 -e arcfour-hmac-md5
  -- ktutil: wkt .keytab
  -- ktutil: q

  Check if the keytab works
  -- kinit -kt .keytab wajid

  If nothing appears in your prompt, it works. Move your .keytab 
  file to /etc/ and rename it to krb5.keytab.

  Use "cern.ch" as default AFS cell
  -- sudo echo "cern.ch" > /etc/openafs/ThisCell

  Setup kerberos5 authentication:
  -- sudo wget http://linux.web.cern.ch/linux/docs/krb5.conf -P /etc 

  Open the /etc/ssh/ssh_config
  HOST lxplus.cern.ch
    ForwardX11 yes
    ForwardX11Trusted no
    GSSAPITrustDNS yes
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials yes

  Renew your token automatically, Open the file /etc/crontab and add the following line:
  -- @daily ID=afstoken kinit --renew
  
  Kerberos only works if your computer clock is in close sync within 
  5 minutes with CERN time servers. 
  -- sudo ntpdate ntp.ubuntu.com

  Install the ntp daemon, which will continuously keep your clock in 
  accurate sync with the CERN time servers.
  -- sudo apt-get install ntp 

  Add the following lines to your /etc/ntp.conf file, and comment the 
  lines for ubuntu time servers:
  # CERN Client
  server 137.138.18.69 version 4 #IP-TIME-0
  server 137.138.16.69 version 4 #IP-TIME-1
  server 137.138.17.69 version 4 #IP-TIME-2
  #Disable remote access, but trust sources of time restrict default nomodify #noquery 
  
  restrict default nomodify noquery
  
  #Allow hosts to query stats and ask for the time.
  #eg restrict 123.123.123.123 nomodify
  #Allow localhost to do everything.
  restrict 127.0.0.1
  #logconfig=all

  Then restart the ntp service:
  -- sudo service ntp restart

  Adding the following line in my .bash_aliases file: 
  -- alias afs="kdestroy && kinit -kt /etc/krb5.keytab wajid -l 7d -r 1d ; aklog CERN.CH"
   
  Debugging:
  -- Restart the console so your alias will work.
  -- Restart the AFS client: sudo service openafs-client restart.
  -- Login with the alias you chose (make sure you get ticket and token).
  -- Make sure the clocks are synced 
  
  Useful links:
  http://akorneev.web.cern.ch/akorneev/howto/openafs.txt
  -------------------------------------------------------

  
  The project is meant for testing the Git repositories and some 
  of the basic commands are listed. Please feel free to add more 
  commands with some short explanation and then please don't forget 
  to create a pull request. 
  -------------------------------------------------------
  
  Make sure you have properly generated SSK keys, if not please follow the link
  https://help.github.com/articles/generating-ssh-keys/

  Generate the SSH keys
  -- ssh-keygen -t rsa -b 4096 -C wajid@cern.ch

  Check if the generated keys are present
  -- ls -al ~/.ssh   
 
  Start the ssh-agent in the background
  -- eval "$(ssh-agent -s)"

  Add them to ssh agent
  -- ssh-add ~/.ssh/id_rsa 

  Testing your SSH connection
  ssh -T git@github.com
	
  List of various topics from Github
  https://help.github.com/index.html
  
  To creat a git repo from command line
  -- curl -u 'wajidalikhan' https://api.github.com/user/repos -d '{"name":"Hello"}'

  Check if the git is installed if not, get it done like
  -- sudo apt-get install git

  Activate the colors:
  -- git config --global color.ui auto 
  
  To initialize a local working copy 
  -- git init
  
  To add a file 
  -- git add <filename>
  
  To commit changes 
  -- git commit -m "first commit"
  
  To select the remote server to push your changes
  -- git remote add origin git@github.com:wajidalikhan/Project.git
  
  To check the remote server
  -- git remote -v

  To push your changes to the selected remote server
  -- git push -u origin master
  
  Always update your working directory to get the latest code
  -- git pull

  To undo the changes in Index before committing
  -- git reset HEAD
  
  To rename a folder 
  -- mv oldfolder newfolder
  -- git add newfolder 
  -- git rm oldfolder
  
  Or 
  -- git mv oldfolder newfolder 

  To clean the untracked files from git
  -- git clean -f ( But beware ... there's no going back). Instead use 

  -- git clean -n (to preview the damage you'll do) 

  To remove directories 
  -- git clean -f -d or git clean -fd

  To remove ignored files 
  -- git clean -f -X or git clean -fX

  To remove ignored as well as non-ignored files
  -- git clean -f -x or git clean  -fx

  To fast-forward if you are behind 
  -- git merge --ff-only origin/master
 
  To detect differences between local repo and remote repo in git? 
  commit your changes on your own branch, totally unrelated to what's 
  going on in remote repositories.          
  -- git commit
  
  Get the contents of the remote repository, but keep them under 
  origin/branch branches. Your own code is unaffected at this point
  -- git fetch origin

  Merge origin/master which is the master branch of the remote 
  repository origin(which you fetched just now) with your current branch
  -- git merge origin/master
  -- git push origin: push back the commit and the merge to the remote repository
  
  -- git fetch origin: update origin/branch branches.
  
  To get the difference between your current branch and the branch origin/master:
  -- git diff origin/master

  In case,something goes wrong you can replace local changes using the e.g.,
  -- git checkout README.txt 

  To create a branch and checkout it out using '-b' option 
  -- git checkout -b new_branch

  To switch to newly created branch
  -- git checkout new_branch

  To list the number of branches 
  -- git branch -r

  To list current branches
  -- git branch 

  To push your local changes to your online repository.
  -- git push REMOTE-NAME BRANCH-NAME

  To rename a branch, you'd use the same git push command, but you would add one more argument: the name of the new branch. For example:
  -- git push origin backportCMSSW14X:backportCMSSW14X
   
  To see the changes of particular has in git
  -- git log -p -1 8504ea7b5ab9cc0b7ce383d907de1dcc6efd2092

  To push the changes in a specific branch
  -- git push --set-upstream origin new_branch  OR 
  -- git push origin new_branch

  To Delete a branch
  -- git branch -d new_branch

  To mergre two branches
  -- git merge origin/new_branch

  To view log 
  -- git log

  To view log but one line details
  -- git log --pretty=oneline
  
  To unstage the commit
  -- git reset HEAD <file>           
  
  To check the status of your working copy
  -- git status  
  
  To creat a pull request
  -- mkdir Testing
  -- cd Testing
  -- git init
  
  Now search git e.g., wajidalikhan/Project and fork this directory 
  then clone this forked directory form your git 
  -- git clone git@github.com:wajidalikhan/Project.git
  -- git remote -v
  
  You should have some thing like 
  -- origin git@github.com:wajidalikhan/Project.git (fetch)
  -- origin git@github.com:wajidalikhan/Project.git (push)
  
  Now add new remote from where we forked the repo 
  -- git remote add upstream git@github.com:wajidalikhan/Project.git
  -- git remote -v 
  
  You should now have something like this
  -- origin git@github.com:<yourusername>/Project.git (fetch)
  -- origin git@github.com:<yourusername>/Project.git (push)
  -- upstream git@github.com:wajidalikhan/Project.git (fetch)
  -- upstream git@github.com:wajidalikhan/Project.git (push)
  
  Now copy/create or write any file here like
  -- touch anytextfile.txt
  -- git add anytextfile.txt 
  -- git commit -m "Testing"
  -- git push origin

  Now, you can just creat a pull request from the git hub page


  Syncing a fork
  ==============
  Sync a fork of a repository to keep it up-to-date with the upstream repository

  -- git clone git@github.com:wajidalikhan/genproductions.git
  -- cd genproductions/

  List the current configured remote repository for your fork.
  -- git remote -v
     origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
     origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

  Specify a new remote upstream repository that will be synced with the fork. e.g., 
     git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

  -- git remote add upstream git@github.com:cms-sw/genproductions.git

  Verify the new upstream repository you've specified for your fork.
  -- git remote -v
     origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
     origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
     upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
     upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

  Change the current working directory to your local project. Fetch the branches and their 
  respective commits from the upstream repository. Commits to master will be stored in a local 
  branch, upstream/master
  -- git fetch upstream
  
  Check out your fork's local master branch.
  -- git checkout master
  
  Merge the changes from upstream/master into your local master branch. This brings 
  your fork's master branch into sync with the upstream repository, without losing your local changes
  -- git merge upstream/master
  
  If your local branch didn't have any unique commits, Git will instead perform a "fast-forward" 
  -- git status
  -- git push
  
  Push your local changes to your directory
  -- git push origin 

  Tags are not pushed by default, push them manually 
  -- git push --tags origin
  

  ---------------------------------------------------- 
  Usefull Weblinks for Git usage:
  http://cms-sw.github.io/tutorial-resolve-conflicts.html
  https://cms-sw.github.io/faq.html#where-can-i-learn-about-git-github-in-general
  http://rogerdudler.github.io/git-guide/ 
  https://github.com/github/hub
  http://blog.trobrock.com/2011/11/17/git-hub-and-pull-requests-equals-awesome-daily-workflow.html

About

This repository is meant for testing some of the basic command for github …

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published