bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js
function(repository, userCredentials){
			var credentials = {
				gitSshUsername : "",
				gitSshPassword : "",
				gitPrivateKey : "",
				gitPassphrase : ""
			};
			
			if(userCredentials !== undefined){
				if(userCredentials.gitSshUsername !== undefined && userCredentials.gitSshUsername !== null) { credentials.gitSshUsername = userCredentials.gitSshUsername; }
				if(userCredentials.gitSshPassword !== undefined && userCredentials.gitSshPassword !== null) { credentials.gitSshPassword = userCredentials.gitSshPassword; }
				if(userCredentials.gitPrivateKey !== undefined && userCredentials.gitPrivateKey !== null) { credentials.gitPrivateKey = userCredentials.gitPrivateKey; }
				if(userCredentials.gitPassphrase !== undefined && userCredentials.gitPassphrase !== null) { credentials.gitPassphrase = userCredentials.gitPassphrase; }
			}
			
			var d = new Deferred();
			this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
				function(pref){
					var settings = pref["settings"];
					if(settings === undefined){
						d.reject();
						return;
					}
				
					if(settings.enabled){
						var data = {};
						data[repository] = credentials;
						this._preferenceService.put(this._prefix, data, {scope: 2}).then(d.resolve, d.reject);
					} else { d.reject(); }
				}.bind(this)
			);
			
			return d;
		}
function(repository, userCredentials){
			var credentials = {
				gitSshUsername : "",
				gitSshPassword : "",
				gitPrivateKey : "",
				gitPassphrase : ""
			};
			
			if(userCredentials !== undefined){
				if(userCredentials.gitSshUsername !== undefined && userCredentials.gitSshUsername !== null) { credentials.gitSshUsername = userCredentials.gitSshUsername; }
				if(userCredentials.gitSshPassword !== undefined && userCredentials.gitSshPassword !== null) { credentials.gitSshPassword = userCredentials.gitSshPassword; }
				if(userCredentials.gitPrivateKey !== undefined && userCredentials.gitPrivateKey !== null) { credentials.gitPrivateKey = userCredentials.gitPrivateKey; }
				if(userCredentials.gitPassphrase !== undefined && userCredentials.gitPassphrase !== null) { credentials.gitPassphrase = userCredentials.gitPassphrase; }
			}
			
			var d = new Deferred();
			this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
				function(pref){
					var settings = pref["settings"];
					if(settings === undefined){
						d.reject();
						return;
					}
				
					if(settings.enabled){
						var data = {};
						data[repository] = credentials;
						this._preferenceService.put(this._prefix, data, {scope: 2}).then(d.resolve, d.reject);
					} else { d.reject(); }
				}.bind(this)
			);
			
			return d;
		}
function ( repository , userCredentials ) { var credentials = { gitSshUsername : "" , gitSshPassword : "" , gitPrivateKey : "" , gitPassphrase : "" } ; if ( userCredentials !== undefined ) { if ( userCredentials . gitSshUsername !== undefined && userCredentials . gitSshUsername !== null ) { credentials . gitSshUsername = userCredentials . gitSshUsername ; } if ( userCredentials . gitSshPassword !== undefined && userCredentials . gitSshPassword !== null ) { credentials . gitSshPassword = userCredentials . gitSshPassword ; } if ( userCredentials . gitPrivateKey !== undefined && userCredentials . gitPrivateKey !== null ) { credentials . gitPrivateKey = userCredentials . gitPrivateKey ; } if ( userCredentials . gitPassphrase !== undefined && userCredentials . gitPassphrase !== null ) { credentials . gitPassphrase = userCredentials . gitPassphrase ; } } var d = new Deferred ( ) ; this . _preferenceService . get ( this . _prefix , undefined , { scope : 2 } ) . then ( function ( pref ) { var settings = pref [ "settings" ] ; if ( settings === undefined ) { d . reject ( ) ; return ; } if ( settings . enabled ) { var data = { } ; data [ repository ] = credentials ; this . _preferenceService . put ( this . _prefix , data , { scope : 2 } ) . then ( d . resolve , d . reject ) ; } else { d . reject ( ) ; } } . bind ( this ) ) ; return d ; }
Saves the given git credentials for the given repository.

@param repository [required] unique repository URL
@param userCredentials.gitSshUsername [optional] git ssh username
@param userCredentials.gitSshPassword [optional] git ssh password
@param userCredentials.gitPrivateKey [optional] git private key
@param userCredentials.gitPassphrase [optional] git passphrase
Saves the given git credentials for the given repository .