Index: src/user.c
==================================================================
--- src/user.c
+++ src/user.c
@@ -306,13 +306,17 @@
 **
 **   (4)  Try the USER environment variable.
 **
 **   (5)  Try the USERNAME environment variable.
 **
+**   (6)  Check if the user can be extracted from the remote URL.
+**
 ** The user name is stored in g.zLogin.  The uid is in g.userUid.
 */
 void user_select(void){
+  char *zUrl;
+
   if( g.userUid ) return;
   if( g.zLogin ){
     if( attempt_user(g.zLogin)==0 ){
       fossil_fatal("no such user: %s", g.zLogin);
     }else{
@@ -325,10 +329,16 @@
   if( attempt_user(db_get("default-user", 0)) ) return;
 
   if( attempt_user(fossil_getenv("USER")) ) return;
 
   if( attempt_user(fossil_getenv("USERNAME")) ) return;
+
+  zUrl = db_get("last-sync-url", 0);
+  if( zUrl ){
+    url_parse(zUrl);
+    if( attempt_user(g.urlUser) ) return;
+  }
 
   fossil_print(
     "Cannot figure out who you are!  Consider using the --user\n"
     "command line option, setting your USER environment variable,\n"
     "or setting a default user with \"fossil user default USER\".\n"