Git is a Source Code Management (SCM) tool for software developers which supports collaborative development of software within a team, and the tracking of changes to software source code over time.
Git is used by developers, and advanced users who need the very latest changes to the software (before releases occur). Software users generally do not need Git; typically they will download official file releases made available by the project instead.
Developers should familiarize themselves with Git by reading the Git Documentation or traversing through a Git tutorial.
Learn how to contribute to a project, using a forked repo and merge requests:
SourceForge.net provides the following features in its Git offering:
Git service may be enabled for your project as follows:
Login as a project administrator and:
Those instructions may be repeated using a different label and path to create multiple repositories.
The standard way to modify the contents of your repository is using a Git client as detailed in the Git User's Manual. Refer to the Getting Started section for how to make your first commit to your new repository.
The following options are available in 2 places: under the "Admin - REPO_NAME" drop-down in the left sidebar of your repository web page (look for the blue text) or via the gear icon after pressing the lock icon (to unlock your top menu bar):
This menu entry helps you to import data into an empty repo (only on some SCMs).
This menu entry lets you specify a space delimited list of filename extensions that should be viewable in the browser (ie., txt for plain-text files).
This menu entry can be used to force the repository's data to be refreshed in the code browser when there is a problem. This data is typically refreshed automatically.
This menu entry lets you configure specific permissions. Fine-grained permissions controls are not supported (e.g. restrict access by specific paths within a repository), if that sort of access control is required, consider creating multiple repositories with different permissions.
This menu entry changes the name of your repo in the menus, but does not have a way to change the mount path that appears in the repository URLs.
This menu entry will delete the repository on our servers, note that while this is normally very quick, but there is occasionally a delay in removal.
We provide read/write access to Git via ssh or https. ssh will provide better performance than https, and should be used whenever possible.
To access a Git repository, configure your Git client as follows (replace PROJECTNAME with the UNIX group name of the project, and the default REPOSITORY is 'code' ):
ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/REPOSITORY(read/write)
If ssh does not work for you, you may use https instead, however, access will be slower:
https://USERNAME@git.code.sf.net/p/PROJECTNAME/REPOSITORY(read/write)
The read/write protocols detailed above can also be used for read-only access (just remove the "USERNAME@" portion). In addition, you may also use the git and http protocols with the same URLs.
For example:
git://git.code.sf.net/p/PROJECTNAME/REPOSITORY/ https://git.code.sf.net/p/PROJECTNAME/REPOSITORY/
The read-only access does not prompt for a password.
The read/write access uses your ssh password or ssh key to authorize your access. To perform write operations, your project administrator must have granted you write access to the repository.
Note: - For all examples below, "PROJECTNAME" represents a SourceForge.net project UNIX name and "USERNAME" represents your SourceForge.net user account.
Your project's Git repository will be empty at the start. If you have a local Git version older than 1.6.2, you won't be able to clone (pull) your remote repository while it is empty, so see below for how to set up a local repository to push your content to our servers.
Create an empty repository on your local machine like this:
$mkdirPROJECTNAME $cdPROJECTNAME $gitinit
For a newer version of git (1.6.2 and later), you can simply clone your empty remote repository and get working:
$gitclonessh://USERNAME@git.code.sf.net/p/PROJECTNAME/REPOSITORY/PROJECTNAME-REPOSITORY $cdPROJECTNAME-code
The first time you try connecting to the git.code.sf.net host, you should see a message similar to the following:
Theauthenticityofhost'git.code.sf.net (216.34.181.155)'can't be established. RSA key fingerprint is 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d. Are you sure you want to continue connecting (yes/no)?
Before typing 'yes' to accept the host fingerprint, ensure the fingerprint is correct for the host. You can find a listing of SSH host keys in the SSH Key Fingerprints list. If you receive a host key warning, please contact the SourceForge.net team.
Users should commit to their project repository using their SourceForge.net username. If that is not already set globally, you can set it locally for the current Git repository like this:
$gitconfiguser.name"YOUR NAME" $gitconfiguser.email"USERNAME@users.sourceforge.net"
You can now use some combination of "git add" and "git commit" commands to create one or more commits in your local repository.
For any local Git repository, you can configure it to push data back to our server by doing the following from inside your Git repository (this replicates what a "git clone" from our servers sets up for you automatically):
$gitremoteaddoriginssh://USERNAME@git.code.sf.net/p/PROJECTNAME/REPOSITORY # if you get an error about already having a remote origin, then run: "git remote remove origin" and try again $gitconfigbranch.master.remoteorigin $gitconfigbranch.master.mergerefs/heads/master
Now you're ready to push the committed files to our servers:
$gitpushoriginmaster
Note: The use of "origin master" prevents Git from complaining that the remote server has no branches in common with your local repository (which is true at the start when the remote repository is empty), and "master" is the default branch in Git.
After the first push, you will be able to use the simpler "git push" to push the master branch to our "origin" server.
Once that is done, you will be able to browse your newly-committed content via the web, clone the repository via either read-only or read/write access methods, push more check-ins, etc.
Webhooks are available for all code repositories. To configure a webhook, go to your repository, and in the left menu expand the Admin section. Then click the "Webhooks" link. You can create and update your webhooks there.
The webhook payloads and signature verification method are documented at https://forge-allura.apache.org/p/allura/wiki/Webhooks/
Please open a support ticket for assistance with server-side configuration like:
If you want to change your git repo's default branch ( say from master
to develop
or main
), you can do it! First, make sure your new branch is created already. Then:
1. Go to your SourceForge git tab.
2. Click the "Admin - " drop-down
3. Click "Set default branch" and enter the new branch name
master
After Changing Default BranchIf you want to delete your previous default branch (i.e. master
) after changing your default, you can by running:
git push origin --delete <old-branch-name>
If you get an error like the following, then open a support ticket for assistance.
$gitcheckoutmain $gitpushorigin--deletemaster remote:error:Bydefault,deletingthecurrentbranchisdenied,becausethenext remote:'git clone'won't result in any file checked out, causing confusion.remote:remote: You can set 'receive.denyDeleteCurrent' configuration variable toremote: 'warn' or 'ignore' in the remote repository to allow deleting theremote: current branch, with or without a warning message.remote:remote: To squelch this message, you can set it to 'refuse'.remote: error: refusing to delete the current branch: refs/heads/masterTo ssh://git.code.sf.net/PATH/TO/GIT/REPO ! [remote rejected] master (deletion of the current branch prohibited)error: failed to push some refs to 'ssh://USERNAME@git.code.sf.net/PATH/TO/GIT/REPO'
SourceForge.net performs routine backups for all of our servers and will restore from these backups in the event of catastrophic server failure. We encourage projects to make their own backups of Git data as that data restore can be performed by the project in the event of accidental data destruction by a member of the project team.
Backups of a Git repository may be made using rsync.
Example (replace PROJECTNAME with the UNIX group name of your project):
$rsync-avgit.code.sf.net::p/PROJECTNAME/REPO.git.
Using rsync is important if repository-side configuration such as hook scripts, a 'description' file, and a non-default 'config' file are used.
Documentation: Docs Home
Documentation: SCM
Documentation: SSH Key Fingerprints
Documentation: Table of Contents - SourceForge.net Documentation