Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git repository cloning logging

I am looking to monitor the cloning activity within my git repository however I cannot find anything that shows how to set this up or how to retrieve this information.

Is this even possible? If so how can this be setup and also how do you retrieve the logging information?

like image 860
user1562690 Avatar asked Jul 30 '12 10:07

user1562690


People also ask

Can you see when someone clones your repository?

Conclusion: Yes, the owner of a repository will see when someone makes a fork on GitHub, but no, they will not see it when someone makes a clone somewhere else.

Does git clone get all history?

Cloning an entire repo is standard operating procedure using Git. Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.

What happens when you clone a git repository?

Git clone is used to copy an existing Git repository into a new local directory. The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally.

How to clone a git repository?

To clone a git repository, use the “git clone” command with the URL of your Git repository. For example, let’s say that you want to clone a public repository from Github, you are going to execute the following command

Why is my Git clone not working?

In some cases, you may be facing authentication failures when performing git clone. Make sure that you are writing the correct password when cloning a repository. In the section dedicated to git clone with password, you may need to inspect the git-credentials file.

How do I clone an empty repository?

An empty repository contains no files. It's often made if you don't initialize the repository with a README when creating it. On GitHub, navigate to the main page of the repository. To clone your repository using the command line using HTTPS, under "Quick setup", click.

How to clone a repository in SharePoint?

In the File menu, click Clone Repository. Click the tab that corresponds to the location of the repository you want to clone. You can also click URL to manually enter the repository location. Choose the repository you want to clone from the list. Click Choose... and navigate to a local path where you want to clone the repository. Click Clone.


1 Answers

You can use a post-checkout hook to update a database or file on your server. This hook runs on the client-side (that is, the person doing the clone will execute the script), so you need to design your script from that perspective. Also, it is possible to clone the repository without executing this hook by adding the --no-checkout option to git clone.

A simple and reliable approach would be to have the server running a small RESTful web service that your hook can call with curl or some similar facility. For example:

#!/usr/bin/env python

import socket, sys, urllib, pycurl

service_url = "https://my.server.dns/service.php"
data = urllib.urlencode({
  'prev':   sys.argv[1],
  'new':    sys.argv[2],
  'branch': sys.argv[3],
  'host':   socket.gethostname()
  })

c = pycurl.Curl()
c.setopt(pycurl.URL, service_url)
c.setopt(pycurl.POSTFIELDS, data)
c.perform()

See http://www.kernel.org/pub/software/scm/git/docs/githooks.html.

like image 74
Justin ᚅᚔᚈᚄᚒᚔ Avatar answered Sep 20 '22 18:09

Justin ᚅᚔᚈᚄᚒᚔ